+ Reply to Thread
Results 1 to 3 of 3

Error due to file name change

  1. #1
    Forum Contributor
    Join Date
    07-31-2008
    Location
    Berkshire, UK
    MS-Off Ver
    2003 & 2007
    Posts
    118

    Error due to file name change

    Hello, I am trying to use the following macro but it keeps returning an error due to the name change. Can anyone point me in the right direction?

    Please Login or Register  to view this content.
    Thank you for any help in advance
    Last edited by simjambra; 08-13-2010 at 03:55 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Error due to file name change

    In VBA, problems are reduced when you reference your workbooks and sheets by variable instead of hardcoding, wherever possible.

    Also, selecting and activating can be reduced to a minimum. In VBA, once you have workbk and worksh identified, you can address your commands to them directly by using a complete reference command.

    This shows how to use the workbook the macro is installed into as a variable workbook reference without ever knowing what the name of the workbook is, then how to copy sheets using that variable...without activating/selecting first.

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    07-31-2008
    Location
    Berkshire, UK
    MS-Off Ver
    2003 & 2007
    Posts
    118

    Re: Error due to file name change

    Thanks very much indeed for your help

+ 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