+ Reply to Thread
Results 1 to 9 of 9

1 Macro stopping another

  1. #1
    Registered User
    Join Date
    06-22-2010
    Location
    Airdrie, Scotland
    MS-Off Ver
    365
    Posts
    42

    1 Macro stopping another

    Hi,

    I have two macros set up to automatically refresh pivot table on two separate worksheets. The code for the first is: -

    Please Login or Register  to view this content.
    The first one runs fine but when I run the second one it falls over at the 'Range("B1")'Select of the first. It'sis probably something very simple that I am doing wrong but I can't for the life of me work it out. Can anyone help?

    Thanks in advance.

    Alan.

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: 1 Macro stopping another

    what is sub RHide doing?
    Looks like it is triggering the change macro in your other sheet
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Registered User
    Join Date
    06-22-2010
    Location
    Airdrie, Scotland
    MS-Off Ver
    365
    Posts
    42

    Re: 1 Macro stopping another

    Kev,

    RHide is hiding rows that have no content...
    Please Login or Register  to view this content.
    Last edited by Theangelp; 05-08-2017 at 04:29 AM.

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: 1 Macro stopping another

    Please edit previous thread and move "[/" to correct place to make the code tags work

    I am guessing that Private Sub RHide is in the other sheet module

    If you move it to a general module, then VBA will run the sub against the active sheet each time
    (If you place a sub in a sheet module it always uses that sheet as its target unless you specifically refer to another sheet)

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: 1 Macro stopping another

    Hi,

    I don't see why you need to select B1 at all. Wouldn't this suffice
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  6. #6
    Registered User
    Join Date
    06-22-2010
    Location
    Airdrie, Scotland
    MS-Off Ver
    365
    Posts
    42

    Re: 1 Macro stopping another

    RHide is in the second sheet module. I've moved it to Module1 but still getting the same error.

    Thanks.

  7. #7
    Registered User
    Join Date
    06-22-2010
    Location
    Airdrie, Scotland
    MS-Off Ver
    365
    Posts
    42

    Re: 1 Macro stopping another

    Thanks xl, that's worked a treat.

  8. #8
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: 1 Macro stopping another

    Xlnitwit is correct. You do not need to select "B1" - removing it will stop the VBA error.
    But note my previous comment - if you want "Hide" to work for any sheet then move it to a GENERAL module otherwise you will need a copy of the sub in EVERY sheet module

  9. #9
    Registered User
    Join Date
    06-22-2010
    Location
    Airdrie, Scotland
    MS-Off Ver
    365
    Posts
    42

    Re: 1 Macro stopping another

    Thanks Kev.

+ 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] Stopping a Macro after a Condition is met
    By JediJoker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2013, 12:45 PM
  2. macro not stopping at correct cell
    By rhudgins in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-14-2010, 11:14 AM
  3. Macro 'stopping' midway
    By rushdenx1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-15-2010, 01:02 PM
  4. Stopping point for a macro
    By benno87 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-28-2009, 04:37 AM
  5. [SOLVED] Macro stopping for one user out of 14
    By David Vollmer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2006, 02:55 PM
  6. Stopping a Macro:CTRL+Break
    By Samir in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-06-2006, 12:20 PM
  7. [SOLVED] Stopping a Macro
    By Paul in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-07-2005, 10:15 AM
  8. Macro Stopping Before End :mad:
    By Nigel_hough in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-22-2005, 08:13 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