+ Reply to Thread
Results 1 to 7 of 7

Loop until won't stop!?

  1. #1
    Registered User
    Join Date
    06-19-2007
    Posts
    47

    Loop until won't stop!?

    I've fixed my previous problem, and this formula works except for one thing!

    it doesnt stop at the last empty cell it continues to create a new sheet but is unable to name it as ther is nothing in the cell from whihc it takes its name.

    why? what have i missed?

    thanks
    Please Login or Register  to view this content.
    Last edited by VBA Noob; 07-26-2007 at 02:17 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524
    Try changing your counter
    This bit of code will count the number of rows in column b, therefore not requiring to say 1 to 100

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-19-2007
    Posts
    47
    Tried this but it still goes past the loop and creates a new sheet which it can't name.

    what does the end(x1up) do?

  4. #4
    Registered User
    Join Date
    06-19-2007
    Posts
    47
    the value of x1up when it finishes is -4162 but i only have 2 row in this test example? should it not be 65536 less 2?

    i have tried clearing the cells below my data but it didnt help?

    thanks

  5. #5
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    The instruction
    Please Login or Register  to view this content.
    do the same thing than go to max row of column 2 (for example B65536) then press 'End' and 'Up' to go to the last row of column 2.

    To fix your problem try to do so:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  6. #6
    Registered User
    Join Date
    06-19-2007
    Posts
    47
    thanks for the help.

    i sorted it buy just using

    n=1

    my coded

    n=n+1
    end sub

    thanks for all the help its mcuh appreciated

    any thoughts on the deleting sheets questions? (see post)

  7. #7
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Why do you have a For loop inside a Do Loop?

    Instead of seleting sheets & ranges all the time you could use something like this code


    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

+ 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