Anyone know what Color Index is this?

asalman07

Active Member
Joined
Jun 12, 2013
Messages
325
I ran a macro and I would like to find out the Color Index Number.

With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -4.99893185216834E-02
.PatternTintAndShade = 0
End With



Thank you all!
 
Djreiswig,

This is perfect!!! Thank you so much!
I wasn't sure if your colored rows were supposed to start with the first one in the selection, or odd/even numbered rows, so I'll give you both.

This changes the color of all of the even numbered rows in the selection. To change the odd numbered rows just change the first = to <>

Code:
Sub AlternateColorBanding()
    Dim MyRange As Range
    For Each MyRange In Selection.Rows
        If MyRange.Row Mod 2 = 0 Then
            MyRange.Rows.Interior.Color = RGB(242, 242, 242)
        End If
    Next
 End Sub

This one changes the color of the first row of the selection and every other one thereafter.
If you want to start with the second row just change the first = to <>.

Code:
Sub AlternateColorBanding()
    Dim MyRange As Range
    For Each MyRange In Selection.Rows
        If MyRange.Row Mod 2 = Selection.Rows(1).Row Mod 2 Then
            MyRange.Rows.Interior.Color = RGB(242, 242, 242)
        End If
    Next
 End Sub
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,215,385
Messages
6,124,626
Members
449,174
Latest member
Anniewonder

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