Worksheet Open First Time Only

Analyze This

Board Regular
Joined
Jul 25, 2003
Messages
133
Good Afternoon,

I would like to run a routine that renames my sheet names when a certain worksheet is opened / activated. The routine runs just fine, but how can I make it only run once per session? I need to wait until linked data is refreshed before I can rename my sheets, so I cannot add this to a workbook open statement. Any suggestions??

thank you!
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Is there a way to *tell* when you've refreshed your linked data (e.g. the linked data will pull in today's date or something)? If so, you should be able to include a line in your code to check that value and fire the rest of the code in your workbook_open event only if that value meets the desired criterion.
 
Upvote 0
there would not be anything constant that happens, other than Excel automatically prompting the user to refresh links. I'm not sure how to tie that into the routine - awesome idea though!
 
Upvote 0
Would changing the setting for updating links (edit --> links --> startup prompt) to "Don't display the alert and update links" circumvent your problem?
 
Upvote 0
No - I have a routine in workbook.open that must run before the second routine. I don't know how to code for something to run after the prompted link refresh, do you?
 
Upvote 0
No, but if you want to run something, update links, then run more code, consider using this:
Code:
ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources
in your code.

Try setting the startup prompt to "Don't display the alert and don't update links" and using that code instead of relying on the user's selection.
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top