+ Reply to Thread
Results 1 to 4 of 4

Error 1004 when selecting range from different sheet

  1. #1
    Registered User
    Join Date
    04-08-2013
    Location
    Sri Lanka
    MS-Off Ver
    Excel 2010
    Posts
    3

    Error 1004 when selecting range from different sheet

    Hi, Im quite new to excel and VBA but i somehow managed to churn out a program that automates the process of generating a summary.

    what its supposed to do is generate a summary for each sheet and then generate and overall summary in the summary sheet.

    this all works fine.. except when i try to merge similar cells in the main summary sheet it gives me a 1004 error. which i just cant understand.

    Heres the code:

    Please Login or Register  to view this content.
    The section ive commented out is the section that creates the problem. The first Range function of that generates the 1004 error.

    heres a test file

    BOQ macro template.xlsm

    the code is bound to the "Generate" button in the second sheet..

    any help is greatly appreciated
    thanks

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Error 1004 when selecting range from different sheet

    The code looks unnecessarily complicated and could be trimmed, but need to understand the task at hand. I understand the summary bit, i.e. the summary from each sheet. but when you say

    "generate a summary for each sheet"
    How do you get(produce) a summary for each sheet?

  3. #3
    Registered User
    Join Date
    04-08-2013
    Location
    Sri Lanka
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Error 1004 when selecting range from different sheet

    hey man, yeah i agree the code looks unnecessarily complicated.. but well actually its my first proper vba program and im more worried about my deadline than elegance hehe
    however the summary for each sheet part works.. it adds up similar parts in the part list and puts it in a table starting from Q5
    and the main summary part works too.. where a copy of summary for each sheet is put in the "summary" sheet
    the thing that doesnt work is the merge part. The final for loop. which should be really simple but im getting a 1004 error that doesnt make sense.
    Thanks for replying

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Error 1004 when selecting range from different sheet

    When I run your code, I did not get any error. I am also would not surprise if you get an error, as you have lots of "Select" on your code. If you do not select the correct item, it will lead to either error, or wrong output.

+ 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