VBA to change cell color

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
Hello All,

I have this code that I am using, however, I need to change part of it, and I don't seem to be doing it correctly.

Code:
Sub OFF()



Dim i As Integer




With Sheets("Print")




For i = 5 To 25
    If .Cells(i, 1).Interior.Color = RGB(255, 209, 117) Then .Cells(i + 5, 6).Value = "OFF"
Next i




End With




End Sub
I need to change it so that if A25 in the sheet "Scheduler" has the cell filled in then cell B10 in the sheet "Print" will say "OFF"
This would apply to A25:T88 (and would fill down and right, accordingly on the "Print" sheet)

Now, there are going to be a few rows where there wouldn't be any need to copy, I don't suppose that matters as long as all the cells that are colored get the text.

Thanks,

Andrew
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
your code is only looking at cells on the sheet "print"

if sheet2!A1=99 then sheet1!B10 = "bingo" is the logic
 
Upvote 0
So how do I change the other sheet? I tried adding a sheet after the "then" portion of the code, but I got an error.
 
Upvote 0
code
code
code
sheet2.select
x=cells(1,1)
sheet1.select
cells(3,1)=x
code
code
end sub
 
Upvote 0
That doesn't make much sense. Are referring line by line? the code doesn't appear to do much on its own.
 
Upvote 0
That doesn't make much sense. Are referring line by line? the code doesn't appear to do much on its own.

it opens sheet2, grabs the value in A1, goes back to sheet1, and sets A3 to the value of A1 in sheet 2
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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