LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 
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



All times are GMT +1. The time now is 06:33 PM.

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"