+ Reply to Thread
Results 1 to 4 of 4

For Each Loop Moving Down One Cell

  1. #1
    Registered User
    Join Date
    01-09-2013
    Location
    south australia
    MS-Off Ver
    Excel 2003
    Posts
    8

    For Each Loop Moving Down One Cell

    Hi i have a For each loop that checks for a date in a range of cells if the date is 21 days old color cell grey. As it loops if any cells are empty i want it to move to the next cell down and continue(tired offset.select but did not work). Heres what i have so far. Thanks in advance
    For Each rcell In Sheet2.Range("DatesofServices")
    If IsEmpty(rcell.Value) Then

    End If

    Servicedate = rcell.Value
    If Date >= Servicedate + 21 Then

    rcell.Offset(0, -5).Interior.ColorIndex = 40

    Else

    rcell.Offset(0, -5).Interior.ColorIndex = xlNone

    End If

    If counter = 9 Then Exit For

    Next rcell[/SIZE][/SIZE]

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: For Each Loop Moving Down One Cell

    Hi, blackrock41,

    welcome to ExcelForum. Maybe try it like this:
    Please Login or Register  to view this content.
    Please use code tags like proposed in Rule #3. Thanks

    Ciuao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    01-21-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: For Each Loop Moving Down One Cell

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-09-2013
    Location
    south australia
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: For Each Loop Moving Down One Cell

    Thanks HaHoBe and sky1in5 both worked great.

+ Reply to Thread

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