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.
LVL 6
FloraAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
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.
0
FloraAuthor Commented:
Did not work.

it threw error.

i copied your code and pasted in workbook open event. and it did not work.
0
Skylar-BarlowCommented:
I had the same issue.  put this code into your workbook open event

change the sheet code name Sheet1  to the actual code name you have.

Run "Sheet1.worksheet_change", Range("a1")
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

ste5anSenior DeveloperCommented:
Of course, you need to adjust it to your actual workbook...

Capture.PNG
btw, the correct approach would be having a public sub in a standard module, which is then called by both events.
1
NorieAnalyst Assistant Commented:
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)?
0
FloraAuthor Commented:
0
FloraAuthor Commented:
Thank you ste5an
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VBA

From novice to tech pro — start learning today.