Combine Workbook open events

VonFeed

New Member
Joined
Dec 12, 2011
Messages
11
Hello, I figured out my last post to make a drop down list default to a certain choice when opening up excel. However I could not edit my post to state so and then ask my follow up question that I have to now to complete my workbook for users. My question is as follows:

How can I cobble together the following codes for workbook_open? What I would like is for a customer/user to open the workbook, 1) see the pop up & then x the pop up, then once the pop up is closed, 2) the workbook takes them to Sheet 2, 3) then the last routine to run resets a drop down list to a default value (can this item also be made to effect multiple sheets that have the drop down list in the same location on those sheets?). Here is my code so far:


Private Sub Workbook_Open()
MsgBox "Hello"
End Sub


Private Sub Workbook_Open()
Worksheets("Sheet2").Activate
End Sub


Private Sub Workbook_Open()
Sheets("Sheet2").Range("V6").Value = Sheets("Sheet1").Range("D5") ..... (((( can this item do this? (Sheets("Sheet2:Sheet5").Range("V6").Value = Sheets("Sheet1").Range("D5") ))))
End Sub


Thanks to everyone for viewing and helping me with this. Step by step I am starting to understand VBA.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,361
Office Version
365
Platform
Windows
You don't need anything special to combine the code but you'll need to add to the code to reset all the dropdowns.
Code:
Private Sub Workbook_Open()

    MsgBox "Hello"

    Worksheets("Sheet2").Activate
    
    For I = 2 To 5
        Sheets("Sheet" & I).Range("V6").Value = Sheets("Sheet1").Range("D5")
    Next I

End Sub
 

Forum statistics

Threads
1,081,441
Messages
5,358,694
Members
400,508
Latest member
fish31

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top