Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Not in KC anymore
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have some code that looks through a range and determines if it falls within a certain time based on the state. If not, then it colors a row of cells. My states are in column C and my times are in columns N and O (as you can probably tell from the code below).

    It's duplicated many times (almost every state) and the only variations are the state names and the times that determines the coloring.


    Below is a snippet for Georgia.


    Code:
    Dim N As Long
    For N = 2 To 1000
        If (Range("C" & N) = "Georgia" And Hour(Range("N" & N)) > 7 And Hour(Range("N" & N)) < 22) Or (Range("C" & N) = "Georgia" And Hour(Range("O" & N)) > 7 And Hour(Range("O" & N)) < 22) Then
            Range("A" & N & ":Z" & N).Interior.ColorIndex = 34
        End If
    Next N
    What I have works just fine, but I'm wondering if there is a quicker or more efficient way of doing this?

    Thanks in advance.

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts
    It looks like you are posting to multiple forums, Does the response at http://eileenslounge.com/viewtopic.php?f=27&t=871 answer your question?

    Steve

Posting Permissions

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