+ Reply to Thread
Results 1 to 4 of 4

Find method loop with ColorIndex

  1. #1
    Registered User
    Join Date
    05-21-2007
    Posts
    79

    Find method loop with ColorIndex

    So, a few days ago I stopped by to see if there was a way to use the .Find method with cell shadings, or ColorIndex values, and got this little bit of code punched up (thanks to Noob):

    Please Login or Register  to view this content.
    So now I'm trying to figure out how to loop this for the scope of a worksheet automatically, but the trouble seems to be that, when the search reaches the last cell with that particular ColorIndex value, it loops back to the top again.

    A previous .Find loop I had set up was this:

    Please Login or Register  to view this content.
    That second bit of code works well, but I don't know how to store a ColorIndex variable or something, whatever it's going to take to actually get this loop put together. All I'd like it to do is the same activity, to every cell shaded that particular color, and then, when it's hit them all, I want it to quit.

    Any way this works out? I'm really unfamiliar with the ColorIndex property.

    Thanks!

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    don't get hung up on the colorindex format issue. Use the same principle as the working loop. If your first find gets a cell, then put that cell address into a variable, then loop until the find loop comes back to that address.


    rylo

  3. #3
    Registered User
    Join Date
    05-21-2007
    Posts
    79
    Alright, I got it.

    Please Login or Register  to view this content.
    Not the prettiest batch of code, that, but it gets the job done.

    EDIT: With a big thanks to rylo for the gentle encouragement!

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Glad you got it worked out. Heres something that I think is a little neater.

    Please Login or Register  to view this content.
    rylo

+ 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