color the interior of a range

  • Thread starter Thread starter Pierre via OfficeKB.com
  • Start date Start date
P

Pierre via OfficeKB.com

Hi experts,

i have the following code to color a range of cells:

sub color
Dim ranga as range
Dim rangb as range
With Sheets("deelnemers")
Set DataRnga = .Range("B3", .Range("C" & Rows.Count).End(xlUp)) 'first
set of cells
Set DataRngb = .Range("E3", .Range("G" & Rows.Count).End(xlUp)) 'second
set of cells
End With
DataRnga.Interior.Color = RGB(154, 255, 154)
DataRngb.Interior.Color = RGB(154, 255, 154)
end sub

The last lines do not work.
any ideas please?
Thanks,
Pierre
 
Your use of RGB look O.K. The following works:

Sub Macro1()
Selection.Interior.Color = RGB(154, 100, 154)
End Sub

Try to msgbox DataRnga.address and DataRngb.address to make sure the correct
cells are being selected.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top