Announcement

Collapse
No announcement yet.

private sub worksheet_change(byval target as range) - in a Sheet

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • private sub worksheet_change(byval target as range) - in a Sheet



    hi,

    I got a number of sheets in my file.
    In one of the sheet - I got a private sub worksheet_change(byval target as range), to capture timestamp.

    I also got a "All Clear" macro in a module.
    "All Clear" - marco clear all the cell value which user fill in the sheet.

    The issue I am having is when I run "All Clear" macro after that the private sub stop working.
    I have to close the file and open it again and it works file.

    I was thinking if there is a way to call "private sub worksheet_change(byval target as range)" written in a sheet from a Macro written in a Module.

    Hope someone can help.
    Thanks

    Saurabh

  • #2
    Did you turn off events before clearing data?
    Code:
    Application.EnableEvents = False
    '[A1]="Hello World!
    Application.EnableEvents = True
    IF you want to call a Change events code, code the Change event to pass Target to a Module's Sub with input parameter Target as Range. The other Module Sub will then call the Module Sub by passing the Target too.

    Comment


    • #3


      You cannot call an event code.

      Attach an example of your workbook.
      Hope that Helps

      Roy

      New users should read the Forum Rules before posting

      For free Excel tools & articles visit my web site

      RoyUK's Web Site

      royUK's Database Form

      Where to paste code from the Forum

      About me.

      Comment

      Working...
      X