View Single Post
  #1   Report Post  
cdavidson
 
Posts: n/a
Default Help with 'Auto_Open' please...

SubThe first time I open my excel workbook, a macro automatically runs. Part
of this macro eventually calls for the deleting of 'Sheet1' in the workbook.
When the macro is finished running, I save the file.

The second time I open the workbook, I want it to check to see if it
contains a 'Sheet1'. If it does, 'Exit Sub', else do something else...

I've pasted my VBA code below. Do you see anything wrong with it?

Many thanks,

Craig

----------------------------------

Private Sub Auto_Open()

calcmod = Application.Calculation

With Application
.Calculation = xlManual
.MaxChange = 0.001
.CalculateBeforeSave = False
End With
ActiveWorkbook.PrecisionAsDisplayed = False


On Error Resume Next

Set sht = Sheets("Sheet1")
If sht Is Nothing Then

Exit Sub

Else

Macro
Application.Calculation = calcmod

End If

On Error GoTo 0

End