ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   color the interior of a range (https://www.excelbanter.com/excel-worksheet-functions/53291-color-interior-range.html)

Pierre via OfficeKB.com

color the interior of a range
 
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


--
Message posted via http://www.officekb.com

Gary''s Student

color the interior of a range
 
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.
--
Gary's Student


"Pierre via OfficeKB.com" wrote:

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


--
Message posted via http://www.officekb.com



All times are GMT +1. The time now is 07:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com