Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

on open

Status
Not open for further replies.

izzyq

MIS
Mar 13, 2002
38
CA
Is it possible for me to manipulate this code such that if the filename is OPEX Variance Analysis rev.2.xls it will run the macro, otherwise, nothing will happen.

Here is the code that I have so far.

Option Explicit



Private Sub Workbook_Open()
Dim filename As String
If filename = "Y:\IQ38316\Data\Excel\OPEX-CAPEX Input Sheets\OPEX Variance Analysis rev.2.xls" Then

'set range you want to clear
Worksheets("Variance Analysis").Range("K30:T53").ClearContents

'returns OrgCode Values back to default "*" value
Worksheets("Variance Analysis").Range("C8:C10").Value = "*"

'returns month back to default of "01-January"
Worksheets("Variance Analysis").Range("B1").Value = "'01"

End If


End Sub

Help Me Obi Wan Kenobi, You're My Only Hope.
 
Since you're in the workbook module, you can use this:

Code:
  if me.name = "bla bla bla.xls"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top