+ Reply to Thread
Results 1 to 7 of 7

Run-time error 1004 with column counter

  1. #1
    Registered User
    Join Date
    07-05-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    13

    Run-time error 1004 with column counter

    Hello Excel Forum,

    On one worksheet I have a range of column headers. Underneath this range of column headers I'd like to copy and paste values that are calculated in another sheet. In the first step I set a variable equal to the length of the column headings, but I'm getting the run-time error 1004: method range of object worksheet failed. I'm thinking this may be an easy syntax problem but I couldn't find any solutions in the forum or through google.

    This is my command button code:

    Please Login or Register  to view this content.
    My workbook is quite large and still in development so I have copied and pasted the three relevant worksheets to a new document:Modified Workbook for Excelforum.xlsm Let me know if any more information is required.

    Many thanks in advance!
    Griffin
    Last edited by GriffinCarpenter; 09-30-2014 at 09:08 AM.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Run-time error 1004 with column counter

    This line doesn't make sense:
    Please Login or Register  to view this content.
    Do you mean:
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Run-time error 1004 with column counter

    Nice simple fix:
    Please Login or Register  to view this content.
    needs to be:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  4. #4
    Registered User
    Join Date
    07-05-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Run-time error 1004 with column counter

    Thanks both, works a charm.

    Just for learning, elsewhere in this workbook I use range instead of cells in this statement:
    Please Login or Register  to view this content.
    Could you tell me why "range" works there?

    Cheers,
    Griffin

  5. #5
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Run-time error 1004 with column counter

    You're using the correct argument for the Range object, in that case, with a cell reference as a single argument (albeit in this case, that single argument is constructed by concatenating a constant and a variable)

    In your original code, you referred to .Range(6, columns count) - you are referring to a cell by referencing the row and column number as separate arguments, so need to use the Cells object. In this case, the Range objects sees 6 and columns.count as separate arguments, and expects each argument to be a range reference. Neither of those values are range references, so it returns an error.

  6. #6
    Registered User
    Join Date
    07-05-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Run-time error 1004 with column counter

    Ok, that helps clarify, thanks.

    Griffin

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Run-time error 1004 with column counter


+ 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] Sort Macro Run-time error '1004': Application/Object-defined error.
    By sam1212 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2014, 10:05 AM
  2. Addon error : Run-time error '1004': Method 'MacroOptions' of object '_Application' failed
    By jtcoleman in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 3
    Last Post: 02-05-2014, 12:23 PM
  3. Replies: 4
    Last Post: 11-15-2013, 05:03 PM
  4. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  5. [SOLVED] run-time error '1004': Application-defined or object-deifined error
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-10-2005, 05:05 PM

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