+ Reply to Thread
Results 1 to 3 of 3

How to call on worksheet.change event in a macro?

  1. #1
    Registered User
    Join Date
    08-22-2018
    Location
    Birmingham, England
    MS-Off Ver
    Professional Plus 2016
    Posts
    1

    How to call on worksheet.change event in a macro?

    Hi,

    In school, I have a worksheet that enables me to choose a student. Below is listed every possible Subject. It uses index/match lookups to find data relevant to that student. I am using code attached to the sheet (View Code) to hide rows with no data. This is made as a Worksheet.Change Event so whenever I select a different student it automatically refreshes to display only those rows applicable to the student. All of this works fine.

    I now want to create a macro that will print the sheet for all of the students, one-by-one. The process of changing the student selection one-by-one is fine, within a For ... Next loop. However, I cannot get it to run the worksheet code to refresh the rows displayed, before printing the sheet. So the data is updating from one student to the next, but the display of the appropriate rows is not.

    So, any ideas what instruction I need to put in the macro to make the worksheet.change happen?

    Many thanks...

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,908

    Re: How to call on worksheet.change event in a macro?

    The change event should fire automatically unless you have added an application.enableevents = false line to your other macro.
    Rory

  3. #3
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: How to call on worksheet.change event in a macro?

    I guess your 2nd macro is changing a value which should fire the change event? As Rory inferred, your Application.EnableEvents should be set to True at the end of your change events code. It should also handle errors so that it is set back to True.

    It is hard to help without seeing code or an example workbook.

    You could set a Modular Sub to take input parameter as the Target range. Then your other macro could just Call it like your change event macro would. Obviously, you would have to call it with the Target range directly. e.g.

    Please Login or Register  to view this content.

+ 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. Worksheet change event copy paste dont call a macro
    By ricklou in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2017, 04:26 PM
  2. [SOLVED] Change Event Call Macro with MS Table Query
    By Redled89 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-16-2016, 11:04 PM
  3. why a Worksheet Change Event during a macro
    By carsto in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-18-2014, 09:31 PM
  4. How Do I call a Macro Using the ComboBox Change Event?
    By Bosco6 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2011, 06:20 PM
  5. Combo Box Change Event with Macro Call
    By Bosco6 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-21-2011, 02:40 PM
  6. [SOLVED] Cell value change to trigger macro (worksheet change event?)
    By Neil Goldwasser in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2006, 10:00 AM
  7. Replies: 5
    Last Post: 06-23-2005, 06: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