Announcement

Collapse
No announcement yet.

Select range, change color of every other row

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Select range, change color of every other row



    I simply want to make a selection, then run code to color every other row grey (within the selection only, not beyond). I know there is a way to do this through conditional formating. I can use this as I have already used all 3 conditions. Any help is appreaciated. Thank you.
    Ed
    *ficus*
    Thanks to all for making this website work!

  • #2
    Re: Select range, change color of every other row

    Hi
    try
    Code:
    Sub test()
    Dim rng As Range, i
    On Error Resume Next
    Set rng = Application.InputBox("Selet Range", Type:=8)
    For i = 1 To rng.Rows.Count
        If i Mod 2 = 0 Then
            rng.Rows(i).Interior.ColorIndex = 15
        End If
    Next
    End Sub

    Comment


    • #3


      Re: Select range, change color of every other row

      capital, works great, thank you much.
      Ed
      *ficus*
      Thanks to all for making this website work!

      Comment

      Working...
      X