+ Reply to Thread
Results 1 to 3 of 3

Do... Loop macro problem

  1. #1
    Registered User
    Join Date
    12-08-2008
    Location
    Hampton, VA
    Posts
    8

    Do... Loop macro problem

    Sorry if this code isn’t written elegantly – I am new to VBA and am learning as I go!

    I’m working on a macro to clear the contents of all the cells in a certain area of the worksheet that are not locked and do not contain a hyperlink. (C7 is the first data-entry cell; EndPage1 is a specific cell near the bottom right of the sheet that sets the outside range of the cells to be cleared. This is the code so far:

    Please Login or Register  to view this content.
    It clears about the first 65 rows beautifully, then on the next row it gets “stuck” in the innermost do-loop and continues across the page rather than looping back to start in column A. Eventually it gets hung up and gives me an error. I can’t figure out why. Can anyone see where I’m going wrong?

    Thanks!

    ETA - saw the problem - see below.
    Last edited by RSimmons; 12-08-2008 at 06:02 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Welcome to the forum.

    Unmerging all cells would be a good place to start.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    12-08-2008
    Location
    Hampton, VA
    Posts
    8
    Thanks!

    Unfortunately I inherited this form, it's huge, and unmerging all the cells would be an undertaking on its own.

    Merging was at the root of the problem, though. (I feel dumb now - I posted and 10 seconds later saw the problem. This after 2 hours of heartburn.) I had to change it to "Loop Until CCounter > CMax" ( > rather than = ). Doh.

+ 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