Hi all!
I need help with a VBA macro. What I need is: If a cell is (color) blue, then pull value from a different column on the same row. (I am using a table.)
Column1 | Column2 | Column3 | Column4 | Column5 | Column6 | Column7 |
(Color Blue) | Test1 | |||||
Test2 | ||||||
Test3 | ||||||
(Color Blue) | Test4 | |||||
Test5 |
result looking for
Column1 | Column2 | Column3 | Column4 | Column5 | Column6 | Column7 |
Test1 | Test1 | |||||
Test2 | ||||||
Test3 | ||||||
Test4 | Test4 | |||||
Test5 |
So far I got (Below is just an example and not sure if it's correct)
'Declare Sheet 1
Dim sh1 as Worksheet
Set sh1=Sheet1
'Delcare Sheet 1 column 1
Dim sh1c1 as Range
Set sh1c1=sh1.ListObjects("Table1").ListColumns(1).DataBodyRange
'Declare sheet 1 column 6
Dim sh1c6 as Range
Set sh1c6=sh1.ListObjects("Table1").ListColumns(6).DataBodyRange
'If cell is blue then column 6
If sh1c1.Interior.Color=RGB(0,112,192) then sh1c6.value
End If
Hi Kenneth,
Can you please attach your actual workbook otherwise any code we write will need to be modified to suit your real workbook environment.
Don't forget t click on Start Upload after selecting your file.
Regards
Phil