View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
andreashermle andreashermle is offline
external usenet poster
 
Posts: 123
Default Alternate Column Shading to be applied only to visible columns

On May 29, 4:10*pm, "Jim Cone" wrote:
'One more time...
'---
Sub ColorColumns_R1()
'Jim Cone - Portland, Oregon USA - May 2010
'Shades every other column in used range *(skips hidden columns).
'Uses specified RGB color for the shade color.
*Dim bColor As Boolean
*Dim Rng * *As Range
*Dim N * * *As Long
*Dim C * * *As Long

*C = RGB(204, 204, 100) *'<<< change to please
*Set Rng = ActiveSheet.UsedRange
*Rng.Interior.ColorIndex = xlColorIndexNone

*For N = 1 To Rng.Columns.Count
* * *If Rng.Columns(N).Hidden Then
* * * *'skip
* * *ElseIf Not bColor Then
* * * * Rng.Columns(N).Interior.Color = C
* * * * bColor = True
* * *Else
* * * * bColor = False
* * *End If
*Next 'N
*Set Rng = Nothing
End Sub
--
Jim Cone
Portland, Oregon *USA
*Review of 'Special Sort' Excel add-in at... *
*http://www.contextures.com/excel-sort-addin.html

"andreashermle"
wrote in message...
Hi Jim,
great, thank you very much for your professional help. It works as
desired. There is one thing I would like to ask you.
How would this code have to be changed if I wanted to use RGB values
as cell fill (such as RGB (224, 224, 224))

Regards, Andreas


Hi Jim,

great job. Thank you very much for your professional help. Regards,
Andreas