LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Help with Workbook_Open

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Private Sub Workbook_Open() doesn't run Steve Starr Excel Discussion (Misc queries) 4 April 3rd 11 05:05 AM
Breaking into Workbook_Open Bob Barnes Excel Discussion (Misc queries) 2 July 29th 09 10:45 PM
Workbook_Open () Bill Martin Excel Discussion (Misc queries) 12 December 20th 05 05:37 PM
Workbook_Open not working Sheena N via OfficeKB.com Excel Discussion (Misc queries) 4 May 6th 05 01:31 AM
Workbook_Open() error Ruan[_3_] Excel Programming 2 September 13th 03 09:13 PM


All times are GMT +1. The time now is 02:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"