+ Reply to Thread
Results 1 to 6 of 6

runtime error 1004 - using a single macro for multiple reports

  1. #1
    Registered User
    Join Date
    12-09-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    6

    runtime error 1004 - using a single macro for multiple reports

    Hi All, I searched this error and could not find any relative solutions for this specific problem. Let me preface by mentioning that I'm very new to Macros and VBA, so this could be the easiest fix ever..

    I am trying to record a macro that I am able to use across different reports that I pull daily. Each report has a different name and data. When I record a macro in file "MD 12-7", I have no problems. When I run this macro on file "MD 12-9", I get the runtime error 1004. Looking at the debug, it seems as though I need to have a dynamic file name, as the code pulls for "MD 12-7!R1C1:R100000C14" each time

    Here's the entire macro:
    Please Login or Register  to view this content.
    Here's the error:
    Please Login or Register  to view this content.

  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,463

    Re: runtime error 1004 - using a single macro for multiple reports

    Try:

    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
    12-09-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    6

    Re: runtime error 1004 - using a single macro for multiple reports

    Hah! That's the tiny piece I was looking for, thanks for the quick reply!

  4. #4
    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,463

    Re: runtime error 1004 - using a single macro for multiple reports

    You're welcome.

  5. #5
    Registered User
    Join Date
    12-09-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    6

    Re: runtime error 1004 - using a single macro for multiple reports

    For future reference, in terms of syntax, can I make the following edits on other macros with the same success?

    i.e.
    Please Login or Register  to view this content.
    becomes
    Please Login or Register  to view this content.

  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,463

    Re: runtime error 1004 - using a single macro for multiple reports

    Well, way to go is try it and see. If you have recorded a macro and it is referring to a hard code workbook or worksheet name, you should be able to change it.

    Pretty much depends on the context.

    Regards, TMS

+ 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. keep getting Runtime error 1004 in my VBA Macro and not sure why
    By Pimp_mentality in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-03-2015, 04:29 PM
  2. Runtime Error 1004 on list creating macro
    By taipalam in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-03-2014, 04:13 AM
  3. [SOLVED] Runtime error 1004. the macro may not be available in this workbook or all macros may....
    By ddander54 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-29-2012, 08:46 AM
  4. Macro - Runtime Error 1004
    By Evian in forum Excel Charting & Pivots
    Replies: 10
    Last Post: 10-08-2008, 04:54 AM
  5. Using a macro to put a function in a certain cell (runtime error 1004)
    By Juhanen II in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-30-2007, 10:29 AM
  6. Excel 2003 Macro Error - Runtime error 1004
    By Cow in forum Excel General
    Replies: 2
    Last Post: 06-07-2005, 09:05 AM
  7. naming tab macro error runtime error 1004
    By D in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-27-2005, 10:06 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