if statement to determine cell fill colour

  • Thread starter Thread starter Legacy 93538
  • Start date Start date
L

Legacy 93538

Guest
Hi

I have written an If statement which sit's inside a loop which loops through a cell range. The if statement should look at the active cell in the cell range and should say if the cell fill colour of the cell in the previous column in the corresponding row is RGB 255 255 0 then paste the following in to the sheet variable PPCWBSht in column 4. However it seems to ignore this and go into the rest of the macro.

I might have written it wrong but i am not sure.

Code:
                If PPFWB.Sheets("IRFORM").Range(cell.Offset(, -1)).Interior.Color = RGB(255, 255, 0) Then
                    PPCWBSht.Cells(NRow, 4).Value = "Sum " & "F" & cell.Row & ":" & "R" & cell.Row

Does anyone know why this code would not work?
Thank you

jessicaseymour
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi dont worry about it i figured it out i did write it wrong!

it should have been

Code:
If PPFWB.Sheets("IRFORM").Range(Mid("ABCDEFGHIJKLMNOPQRSTUVWXYZ", cell.Column - 1, 1) & cell.Row).Interior.Color = RGB(255, 255, 0) Then

not:

Code:
If PPFWB.Sheets("IRFORM").Range(cell.Offset(, -1)).Interior.Color = RGB(255, 255, 0) Then
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,700
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top