+ Reply to Thread
Results 1 to 8 of 8

Prompt Error Messages if Row exceeded Limit

  1. #1
    Registered User
    Join Date
    01-06-2009
    Location
    KL, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    57

    Prompt Error Messages if Row exceeded Limit

    Hi, I have a macro file that allow me to combine all the files in the same workbook. My problem now is to prompt an error message if my combined sheet exceeded row limit. I'm not very good in VBA and i hope someone can amend the macro file for me.

    Thank you very much

    Apple

    Please Login or Register  to view this content.
    Last edited by Apple Ling; 07-06-2010 at 10:39 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Prompt Error Messages if Row exceeded Limit

    Try this
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Prompt Error Messages if Row exceeded Limit

    Roy;
    In the previous message you have:
    Quote Originally Posted by royUK View Post
    Please Login or Register  to view this content.
    1) What does the final (2) do?
    2) Wouldn't this overwrite the last row of the data already on the sheet?
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Prompt Error Messages if Row exceeded Limit

    it's a typo

  5. #5
    Registered User
    Join Date
    01-06-2009
    Location
    KL, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    57

    Re: Prompt Error Messages if Row exceeded Limit

    Hi Roy, thanks for your reply but the code doesn't work well at my end. It's only copy the header in to Combined sheet. I don't know what is the problem. I attached here with the sample file. May be you could have a look

    Thanks
    Apple
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Prompt Error Messages if Row exceeded Limit

    Hi Apple;
    Change the following lines:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Finished product:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-06-2009
    Location
    KL, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    57

    Re: Prompt Error Messages if Row exceeded Limit

    Hi foxguy, i have amended the given code and it looks fine . However, if one of the data source does not place it correctly, the data from that particular sheet will not be transferred. Attached here with the sample output. The data on sheet 3 does not transfer to Combined sheet.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Prompt Error Messages if Row exceeded Limit

    Hi Apple Ling;

    Techinically, this new problem should be in a new thread, because it has nothing to do with the original question. So don't be surprised if a moderator says something about it.

    CurrentRegion doesn't select all cells in the sheet. It only selects the cell that are surrounded by spaces. In your sample there are blank rows between row 1 and row 17, so CurrentRegion doesn't get them all.
    UsedRange is what you should use to get all used cells in the sheet.
    Please Login or Register  to view this content.
    One warning about UsedRange. It doesn't always start in A1. If Row 1 is blank, and Column A is blank, then UsedRange's top left corner will be B2.
    If you always want to have A1 as the top left corner then use this
    Please Login or Register  to view this content.
    Another note:
    I recommend not using
    Please Login or Register  to view this content.
    Sheets(1) is not always the first sheet.

    A safer way:
    Please Login or Register  to view this content.
    One Final Note, for more user friendly code:
    Your section:
    Please Login or Register  to view this content.
    would be better like this:
    Please Login or Register  to view this content.
    That way, you don't have to delete the sheet every time you run the macro.[/SIZE]
    Last edited by shg; 07-05-2010 at 02:46 PM.

+ 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