A
andreashermle
Dear Experts:
Below macro is used to apply an alternate fill to selected cells.
I would like to get this macro changed to include also a specific fill
for a HEADER row (selected cells at the very top), ...
ie. the selected cells will also contain a header row. And these
header cells should get the following fill:
RGB(165, 165, 165), the font of this header is to be changed to bold
and font color is to be changed to white.
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
Sub AltShade_GreyRed()
Dim Counter As Integer
If MsgBox("Would you like to apply an alternate shading to
selected cells (grey/red)?", vbQuestion + vbYesNo, "Selected cells
alternate shading grey/red") = vbNo Then
Exit Sub
End If
'For every row in the current selection...
For Counter = 1 To Selection.Rows.Count
'If the row is an odd number (within the selection)...
If Counter Mod 2 = 1 Then
'Set the color to ...
Selection.Rows(Counter).Interior.Color = RGB(229, 229,
229)
'If the row is an even number (within the selection)
Else
Selection.Rows(Counter).Interior.Color = RGB(239, 211,
210)
End If
Next
End Sub
Below macro is used to apply an alternate fill to selected cells.
I would like to get this macro changed to include also a specific fill
for a HEADER row (selected cells at the very top), ...
ie. the selected cells will also contain a header row. And these
header cells should get the following fill:
RGB(165, 165, 165), the font of this header is to be changed to bold
and font color is to be changed to white.
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
Sub AltShade_GreyRed()
Dim Counter As Integer
If MsgBox("Would you like to apply an alternate shading to
selected cells (grey/red)?", vbQuestion + vbYesNo, "Selected cells
alternate shading grey/red") = vbNo Then
Exit Sub
End If
'For every row in the current selection...
For Counter = 1 To Selection.Rows.Count
'If the row is an odd number (within the selection)...
If Counter Mod 2 = 1 Then
'Set the color to ...
Selection.Rows(Counter).Interior.Color = RGB(229, 229,
229)
'If the row is an even number (within the selection)
Else
Selection.Rows(Counter).Interior.Color = RGB(239, 211,
210)
End If
Next
End Sub