View Single Post
  #2   Report Post  
Chip Pearson
 
Posts: n/a
Default Help with 'Auto_Open' please...

What specific problem are you having?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"cdavidson" wrote in
message
...
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