+ Reply to Thread
Results 1 to 8 of 8

What Wrong With my Code? compile information to worksheet

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

    What Wrong With my Code? compile information to worksheet

    I've written the attached code and can't figure out what i'm doing wrong. I'm trying to copy, sort, and paste information from a bunch of sheets. The below code goes into a death spiral copying and pasting only from the first sheet in my workbook. What's wrong with my code? Why won't it continue through the loop?

    Please Login or Register  to view this content.
    Last edited by sjennings007; 12-23-2015 at 06:55 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: What Wrong With my Code? compile information to worksheet

    Please Login or Register  to view this content.
    simply loops through each of the sheets in the workbook. The easy way, but slow and inefficient, is to select the sheet as the first line of code in the loop.

    Better would be to use With sh ... End With and "connect" the ranges using a "dot" (.)

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


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

    Re: What Wrong With my Code? compile information to worksheet

    That worked, kinda. now the sorting (if statements) isn't working. it just lumps it into my "else" statement.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: What Wrong With my Code? compile information to worksheet

    Can you post the current code?
    If posting code please use code tags, see here.

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

    Re: What Wrong With my Code? compile information to worksheet

    I think I figured it out. Thanks for the help.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: What Wrong With my Code? compile information to worksheet

    You're welcome. Thanks for the rep.

    I'm struggling to picture what your workbook, worksheets, data and structure look like. Where's the data start and finish? I can see you want to copy and transpose data but I'm confused about what you need to end up with.

    Suggest you post a sample workbook with some typical data.

    Regards, TMS

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

    Re: What Wrong With my Code? compile information to worksheet

    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. The info is confidential, but that's the lay of the land.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: What Wrong With my Code? compile information to worksheet

    The info is confidential
    Mock it up

+ 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. [SOLVED] How to handle error code when wrong password is entered for unprotect worksheet?
    By redsab in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-18-2020, 09:01 AM
  2. [SOLVED] VBA code needed that will compile data onto another worksheet
    By Jim885 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-11-2014, 08:27 PM
  3. Problem with VBA code to show a veryhidden worksheet - Compile Error
    By maryren in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-06-2014, 10:42 AM
  4. [SOLVED] Excel VBA Compile Error wrong number of arguments
    By gjwilson1216 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-24-2013, 03:08 PM
  5. [SOLVED] What is wrong with this code? Compile error etc
    By ExcelFailure in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-30-2013, 08:18 AM
  6. [SOLVED] VBA - Compile Error - Wrong number of arguments
    By Janto724 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-28-2013, 06:04 AM
  7. Compile Error - Wrong number of arguments
    By freebird_wr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-25-2013, 09:34 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