+ Reply to Thread
Results 1 to 9 of 9

How is this macro activated? Need to update.

  1. #1
    Registered User
    Join Date
    07-01-2011
    Location
    Australia
    MS-Off Ver
    Excel 2011 (Mac)
    Posts
    38

    How is this macro activated? Need to update.

    I have the below macro which compiles data from a number of sheets - whose sheetnames are listed on the sheet LoadList - to a MasterSheet. Every month I add a new sheet and add its name to the LoadList. It was originally written to update when one of the cells on one of the sheets in the LoadList was changed, but now this seems not to be happening when I edit one of the sheets that I have since the macro was written.

    What I would like is to update the macro so that if ANY of the sheets are updated in the LoadList the Macro is activated.

    Thanks!
    Zac

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    01-27-2015
    Location
    Queanbeyan, Australia
    MS-Off Ver
    2010
    Posts
    5

    Re: How is this macro activated? Need to update.

    Try the worksheet change event on the LoadList worksheet


    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-01-2011
    Location
    Australia
    MS-Off Ver
    Excel 2011 (Mac)
    Posts
    38

    Re: How is this macro activated? Need to update.

    Hi ozbod,

    Thanks for your reply and your suggestion I think it might get me part the way there.

    My concern is this.....my sheets are arranged as follows:

    Master Sheet, Jul, Jun, May, Apr, Mar, Feb, Jan, LoadList

    The above code is stored on the Master Sheet, and I want the code to run when any of the Monthly sheets (in bold) have a Worksheet change event - Does that make sense? The load list can be used to activate the macro.

    Currently I must go back to one of the old sheets that existed when the macro was written, say the 'Feb' or 'Jan' one, and edit a cell in one of these sheets before the macro will run.

    Interestingly, when I do this it pulls information from ALL sheets perfectly, so it is just an activation problem.

    Any ideas?

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: How is this macro activated? Need to update.

    Perhaps this modification to ozbods code will do what you wish? To get it to work right click on "ThisWorkbook" -> "View Code" and paste the code in new window. Not sure but you probably need to change "(General)" to "Workbook" in the dropdown list (top left macro window).

    Please Login or Register  to view this content.
    Alf

  5. #5
    Registered User
    Join Date
    07-01-2011
    Location
    Australia
    MS-Off Ver
    Excel 2011 (Mac)
    Posts
    38

    Re: How is this macro activated? Need to update.

    Hi Alf - thanks for your reply!

    I tried this but get the error "sub or function not defined"...

    Any ideas?

    Thanks in advance!

  6. #6
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: How is this macro activated? Need to update.

    Did you change "(General)" to "Workbook" in the dropdown list (top left macro window)?

    Aside from this and checking the name "CombinedSelected" is an excisting macro name I don't have any other ideas.

    See link for supported workbook events

    http://www.tutorialspoint.com/vba/vba_events.htm


    Alf

  7. #7
    Registered User
    Join Date
    07-01-2011
    Location
    Australia
    MS-Off Ver
    Excel 2011 (Mac)
    Posts
    38

    Re: How is this macro activated? Need to update.

    Thanks Alf,

    When I clicked on ThisWorkbook and View Code and pasted the code the box at the top changed to "Workbook" automatically.

    The CombinedSelected macro is stored on the "Master Sheet" sheet code - should it be in a separate module?

  8. #8
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: How is this macro activated? Need to update.

    Well you could try and move the macro CombinedSelected to a separate and see if this helps.

    But if I understands you right the code ozbod posted did work for you and then you had the CombinedSelected stored on the "Master Sheet" code so I'm not sure what happends.

    Alf

  9. #9
    Registered User
    Join Date
    01-27-2015
    Location
    Queanbeyan, Australia
    MS-Off Ver
    2010
    Posts
    5

    Re: How is this macro activated? Need to update.

    Malkier,

    Sorry for the delay but have been away for the last week.

    I read your original post to be that when any cell in "Loadlist" was changed then activate the macro. It seems that you are looking for when any cell in Jul, Jun,May etc is changed that you want the macro to activate. What is contained in the Loadlist sheet, is it just a reference to all the Jul,Jun etc sheets?

    Firstly, I would recommend that you put the code in a separate module rather than master.

    Alf's suggestion is a possible way to trigger this but you would need to restrict this so that any update to "Master List" is excluded from the call otherwise you may potentially end up in an endless loop. Question is, are you fundamentally trying to add to, or repopulate Master List based on the event.

    Possibly try (in 'This Workbook'... Workbook)

    Please Login or Register  to view this content.
    Beware however, without testing based upon your structure, that changes (like formatting) may also trigger the call to the macro and depending on the size this may cause some aggravation.

    Edit: I have just done a quick test and formatting changes do not seem to activate the macro, only when I change values (Excel 2010)

    Set up a test workbook with a sheet called Master List + several other sheets (default will do) and in This Workbook have the code

    Please Login or Register  to view this content.
    .... and in a new Module have

    Please Login or Register  to view this content.

    From here change the values in any of the other sheets, then change the formatting and see if the value changes in Master List (please note change the format in column A of Master List to include seconds)
    Last edited by ozbod; 03-27-2015 at 03:31 AM. Reason: Update

+ 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. If sheet activated -> update the charts on the sheet
    By lukelucky in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-16-2015, 04:59 AM
  2. Macro activated by pwd
    By graiggoriz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-05-2014, 03:56 AM
  3. Create Macro to move values from the current sheet in which the macro is activated
    By Turkish1801 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-06-2013, 06:11 PM
  4. Macro activated after a specified time
    By buffalobill in forum Excel General
    Replies: 9
    Last Post: 03-26-2010, 12:00 PM
  5. can't update chart series unless its activated
    By Woody in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2005, 09:05 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