+ Reply to Thread
Results 1 to 10 of 10

Debug my loop!

  1. #1
    Registered User
    Join Date
    08-21-2013
    Location
    United States
    MS-Off Ver
    2010
    Posts
    41

    Debug my loop!

    The attached code works perfectly for the first sheet, but on the second i get error "1004: Method 'Range' of object'_Worksheet' failed". I've attached an example of what the data looks like that i'm working with. We have a spreadsheet for every customer. I'm trying to copy the information into one spreadsheet in a database format. Since the customers may be located in different locations i'm trying to separate the information between the three regions.

    Please Login or Register  to view this content.
    Compile example.xlsm

    Edit: I just tested it again, and now it is saying that I have a compile error "End With without With". So I have even more problems
    Last edited by sjennings007; 12-24-2015 at 12:38 PM.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Debug my loop!

    Try:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2405
    Posts
    25,048

    Re: Debug my loop!

    I'll look at the first problem but to solve the second problem change "Do Until" to "Loop Until".
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Registered User
    Join Date
    10-18-2015
    Location
    Lisbon, Portugal
    MS-Off Ver
    2010
    Posts
    38

    Re: Debug my loop!

    Greetings,

    Could you please elaborate what range would you like to pass from Client1 to US ws for example?

    I assume you want it to loop from finNumb = 3 until finNumb = 7 to the respective ws?
    Also, i made a couple of changes:

    Please Login or Register  to view this content.
    No more compile error, but I don't understand the "Do Until FinNum > 7" part.

    Regards,
    Daniel

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2405
    Posts
    25,048

    Re: Debug my loop!

    Range does not have a Paste method. That is a method of Worksheet. Use PasteSpecial instead.

    I am still seeing an error, however. Are you really intending to copy a column from the US sheet and paste it back into the same sheet, transposing it to a row?

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Debug my loop!

    Maybe:

    Please Login or Register  to view this content.

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2405
    Posts
    25,048

    Re: Debug my loop!

    Quote Originally Posted by dafer660 View Post
    i made a couple of changes:
    Please Login or Register  to view this content.
    This is better than a separate Copy then a Paste, but you have overlooked the original intent to transpose the column to a row.

  8. #8
    Registered User
    Join Date
    08-21-2013
    Location
    United States
    MS-Off Ver
    2010
    Posts
    41

    Re: Debug my loop!

    The If like client doesn't work. they are real client names with no pattern.

  9. #9
    Registered User
    Join Date
    08-21-2013
    Location
    United States
    MS-Off Ver
    2010
    Posts
    41

    Re: Debug my loop!

    Well it worked!!! Thanks for all of your help.

  10. #10
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Debug my loop!

    You're welcome and thanks for the rep

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Loop Sub until debug
    By drewkenna in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2015, 09:13 AM
  2. Pause and debug at a particular point in a loop
    By ualdriver in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2015, 12:12 AM
  3. VBA Code Runs in Debug Mode But Returns Type Mismatch Error Outside Debug Mode
    By valerie.k.chiang in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2014, 03:48 PM
  4. [SOLVED] Debug: How to debug this code?
    By reach78 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-25-2013, 07:16 AM
  5. How do debug a loop?
    By max3732 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-24-2013, 04:27 PM
  6. [SOLVED] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 PM
  7. Debug this?
    By hke in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-11-2005, 11:31 AM

Tags for this Thread

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