Results 1 to 8 of 8

Macro hangs up in formatting loop

Threaded View

  1. #1
    Forum Contributor
    Join Date
    10-16-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2003, 2010
    Posts
    151

    Macro hangs up in formatting loop

    I have a report that I am trying to automate and I have run into a snag in getting the formatting to work. I am trying to alternate row color to make it a bit easier to read but it seems to want to hang up in the loop. Here is the code I am running, I don't see what I am doing wrong, and would appreciate any suggestions.

    Sub test()
    
        If Cells(12, 4) > 0 Then
            Set m = Range(Cells(12, 6), Cells(12, 6).End(xlDown))
    
            For Each f In m
                If f.Row Mod 2 = 0 Then 'Khaki
                    Range(f, f.End(xlToRight)).Cells.Interior.Color = RGB(225, 205, 175)
                        Else            'Light Khaki
                    Range(f, f.End(xlToRight)).Cells.Interior.Color = RGB(255, 235, 205)
                End If
            Next f
        End If
    
    End Sub
    Thanks!
    Last edited by jacob@thepenpoint; 07-09-2013 at 08:52 AM.
    Jacob Albers
    Excel 2003 & 2010

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1