+ Reply to Thread
Results 1 to 11 of 11

getting runtime error 9 with a macro to copy visible data to a summary sheets

  1. #1
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    getting runtime error 9 with a macro to copy visible data to a summary sheets

    I have a subtotal for range of data (sheet name workings) , however need to copy specific columns with visible rows to another sheet called (summary ).

    See attached expected results of summary sheet in same workbook

    Looking for a vba code to copy to last data range to a new sheet in same workbook.

    As below code used but getting runtime error 9 script out of range

    Can someone assist what going wrong

    HTML Code: 


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

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

    Re: getting runtime error 9 with a macro to copy visible data to a summary sheets

    There is a typo. The sheen name summary is not the same.

    Set x = Sheets("Summary").Rows(1).Find(.Cells(1, i), lookat:=xlValues, LookIn:=xlWhole)

    Just copy the sheet name from the sheet itself and copy in to x.

  3. #3
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: getting runtime error 9 with a macro to copy visible data to a summary sheets

    Tried but unsucessful,

    Tried rename sheets as summ as well in the code , still unsucessful.

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

    Re: getting runtime error 9 with a macro to copy visible data to a summary sheets

    I do not know how you got this syntax.
    Wrong
    Set x = Sheets("Summary").Rows(1).Find(.Cells(1, i), lookat:=xlValues, LookIn:=xlWhole)

    Right
    Set x = Sheets("Summary").Rows(1).Find(.Cells(1, i), LookIn:=xlValues, Lookat:=xlWhole)

  5. #5
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: getting runtime error 9 with a macro to copy visible data to a summary sheets

    Thanks working but not getting the columns N in of workings sheet into summary columns A which remains blank.

    Any ideas what is going wrong
    Attached Images Attached Images

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

    Re: getting runtime error 9 with a macro to copy visible data to a summary sheets

    The code is not finding "Tariff No Description Origin".

    Tariff No Description Origin
    is the NOT the same as

    Tariff No Description Origin

    You need to copy the value from N1 in to code. Make sure that the values in both code and excel match since this is exact look up match.

    You also need to make sure the code starts at sheet workings, not active sheet

    Set ws = Sheets("workings")

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

    Re: getting runtime error 9 with a macro to copy visible data to a summary sheets

    I repasted the Tariff header and ran it like this:

    Please Login or Register  to view this content.
    Basically the there was nothing wrong with the code only that header was corrupted
    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

  8. #8
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: getting runtime error 9 with a macro to copy visible data to a summary sheets

    AB33 &xladept thank you both for advise and solution .

    Now it works as expected

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

    Re: getting runtime error 9 with a macro to copy visible data to a summary sheets

    You're welcome and thanks for the rep!

  10. #10
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: getting runtime error 9 with a macro to copy visible data to a summary sheets

    @ xladept,

    Now you have gone to far!

    This is a FINAL WARNING for you not to test my temper, with coming up with a workable solution that appears so simple!

    If I never hear from you again, it will be too soon!
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

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

    Re: getting runtime error 9 with a macro to copy visible data to a summary sheets

    @ Winon - miss you buddy

+ 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] issue with a copy macro between sheets in same workbook runtime error 9
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-07-2017, 10:58 PM
  2. string macro for a user input button, copy and paste data from all sheets to summary
    By Lawleypops in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-15-2015, 11:17 AM
  3. string macro for a user input button, copy and paste data from all sheets to summary
    By Lawleypops in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2015, 11:09 PM
  4. Replies: 6
    Last Post: 06-05-2014, 04:40 AM
  5. Copy Multiple Sheets produces RunTime Error
    By moxman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-09-2013, 04:13 AM
  6. Macro VBA Copy Paste Across Sheets Runtime '1004'
    By scrags in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-31-2012, 01:23 PM
  7. Copy only Visible cells to another sheet in Macro? Runtime 438 error?
    By nbaj2k in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-18-2006, 11:30 AM

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