Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello
Below is the code I run on Sheet 2 with a Worksheet_Change event. I would like to run this code when the User opens the Workbook using the Workbook_Open event. I am new to VBA, so any help will be greatly appreciated. Code from Sheet2 Module Private Sub Worksheet_Change(ByVal Target As Range) ' Unprotecting Worksheet Worksheets("Sheet 2").Unprotect Password:="1234" ' Unhide Rows before extracting Data With Rows("9:409") .EntireRow.Hidden = False End With ' Target of Combo Box for Doctor List (F2) If Target.Row = 2 And Target.Column = 6 Then ' Calculate criteria cell in case calculation mode is manual Worksheets("Sheet 1").Range("AA2").Calculate Worksheets("Sheet 1").Range("Data_Log") _ .AdvancedFilter Action:=xlFilterCopy, _ CriteriaRange:=Sheets("Sheet1").Range("AA1:AA2"), _ CopyToRange:=Range("A8:H8"), Unique:=False ' Hide Blank Rows Worksheets("Sheet 2").Unprotect Password:="1234" With Range("B9:B409") .EntireRow.Hidden = False .SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True .EntireRow.Font.ColorIndex = 1 End With End If ' Protecting Worksheet Worksheets("Sheet 2").Protect Password:="1234", Scenarios:=True End Sub Thanks in advance Ruan |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Private Sub Workbook_Open() doesn't run | Excel Discussion (Misc queries) | |||
Breaking into Workbook_Open | Excel Discussion (Misc queries) | |||
Workbook_Open () | Excel Discussion (Misc queries) | |||
Workbook_Open not working | Excel Discussion (Misc queries) | |||
Workbook_Open() error | Excel Programming |