Hi Chip:
My excel file is actually handled by a trid party application, so I can't
watch the macros run. I believe a line of code I have which is supposed to
delete Sheet1 first time through, isn't working correctly becauise the entire
macro runs again when I open the file a second time. I realize it's the
'Delete Sheet1' area of code I probably need to focus on, but first wanted to
make sure the 'auto_Open' code looked good.
If you can't see any serious mistakes in my 'Auto_Open' sub???, then I'll
move on to troubleshooting why the third party app isn't allowing my macro to
delete Sheet1 the first time it runs.
Thanks,
"Chip Pearson" wrote:
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