Refresh worksheets on open force any macros to run if required

VonFeed

New Member
Joined
Dec 12, 2011
Messages
11
Hello, I am working on a Workbook_Open formula. Right now the formula works, but it's not forcing Sheet 11 & Sheet 12 to do something. Normally on those Sheets once you click V6 (which is a data validation drop down list) it activates a VBA code for Worksheet_Change which tests if V6=V2 on the individual sheet and if not do: Application.Run "Do_it_1".

How can I incorporate the Application.Run "Do_it_1" into the below code or is there another way? FYI I have multiple sheets and Sheet 1-10 are not part of this formula and cannot be changed, so I cannot have a code that just checks every sheet in the workbook, but rather sheets 11-20.

Private Sub Workbook_Open()
MsgBox "Hello"

Application.EnableEvents = False
Sheet11.Range("V6").Value = Sheet2.Range("D5") '(THIS forces a drop down list to revert to the top choice)
Sheet12.Range("V6").Value = Sheet2.Range("D5") '(THIS forces a drop down list to revert to the top choice)
Sheet10.Activate
Sheet10.Range("T12").Select

Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True

End Sub

Thanks for everyone's help.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Change the declaration of the Sheet11 Change event to
Code:
[U]Public[/U] Sub Worksheet_Change(ByVal Target As Range)

Then change the Workbook_Open code to
Code:
'...
Application.EnableEvents = False
With Sheet11
    .Range("V6").Value = Sheet2.Range("D5") '(THIS forces a drop down list to revert to the top choice)
    .Worksheet_Change(.Range("V6"))
End With
'...
Similarly with Sheet12.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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