Link to home
Start Free TrialLog in
Avatar of Flora Edwards
Flora EdwardsFlag for Sweden

asked on

How to fire the worksheet change event from workbook open event.

How to trigger workbook change event for a specific worksheet or all worksheet with workbook open event?

I have some code on a Private Sub Worksheet_Change(ByVal Target As Range)

this does not automatically fires up, unless something changes in the worksheet cell.

I want the worksheet change event to be fired when the workbook opens.
Avatar of ste5an
ste5an
Flag of Germany image

E.g.

On Local Error Resume Next

Dim Target As Excel.Range

Set Target = Nothing
Call Worksheet_Change(Target)

Open in new window


in the open event. But depending on the code in the change event, this may fail or even throw errors.
Avatar of Flora Edwards

ASKER

Did not work.

it threw error.

i copied your code and pasted in workbook open event. and it did not work.
ASKER CERTIFIED SOLUTION
Avatar of Skylar
Skylar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Of course, you need to adjust it to your actual workbook...

User generated image
btw, the correct approach would be having a public sub in a standard module, which is then called by both events.
Avatar of Norie
Norie

What does the code in the worksheet change event(s) do?

If also you want it to run when the workbook opens then perhaps it shouldn't be in the change event(s)?
Thank you ste5an