+ Reply to Thread
Results 1 to 4 of 4

Macro does not work when I move / copy sheet within the same workbook

  1. #1
    Registered User
    Join Date
    09-20-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    7

    Macro does not work when I move / copy sheet within the same workbook

    I am a new user of macros, but every month I have to create a new dashboard that I show "Open" for me to enter the information, and "Closed" so the managers see the totals only. I did not write the macro, I just recorded it.
    I recorded the following macro in my sheet "September", but when I use the "Move or Copy" to create the sheet and rename it October (this is within the same file), the macro does not work in the new sheet. This is a basic macro to hide and unhide rows and columns. (error 400)
    Please help;

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by alansidman; 09-20-2013 at 12:16 PM. Reason: Added Code Tags

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2407 Win 11 Home 64 Bit
    Posts
    24,075

    Re: Macro does not work when I move / copy sheet within the same workbook

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    I have added the code tags for you this time as you are new to the forum. Please comply in the future with our rules.

    Alan
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    09-20-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Macro does not work when I move / copy sheet within the same workbook

    I did not mentioned before but I am running these macros with two buttons I created (one to open one to close). When I create the new page automatically creates 2 new macros:
    Sheet6.ShowClose
    Sheet6.ShowOpen

    Before duplicating the sheet I just had:
    Sheet5.ShowClose
    Sheet5.ShowOpen

    So I need to change my buttons to point to the right macro every time. Is there a way that the same two original macros work for both sheets (or as many as I create)?

    Thanks,

  4. #4
    Registered User
    Join Date
    09-20-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    7

    Lightbulb Re: Macro does not work when I move / copy sheet within the same workbook

    Never mind, I found the issue. I was creating the macro under the specific sheet. I needed to created under "thisworkbook"
    Thanks for the help

+ 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. Replies: 2
    Last Post: 09-04-2012, 01:19 AM
  2. How to disable Move or Copy option in menu of one sheet only in workbook
    By nuttyengineer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-02-2011, 08:02 PM
  3. Macro to copy over and paste data in to a work sheet from a closed workbook
    By munkee in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-24-2009, 04:04 AM
  4. Move/Copy macro doesn't work as aspected
    By Pero in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-25-2009, 03:17 PM
  5. [SOLVED] Find and Open Workbook then copy and move sheet
    By cwilson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2005, 05:54 PM

Tags for this Thread

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