Prev Previous Post   Next Post Next
  #1   Report Post  
Anthony
 
Posts: n/a
Default VB Script error

Hi,
I was given this script below in answer to a previous question by Bob
Phillips (thanks Bob) . Here is my previous question :
"if a log for 'today' has already been created, what code do I (well you!)
need to add to advise the user of this, and a message box asking them if they
want to view it,then being taken there if required.,
thanks again"
the script Bob provided is
Sub Create_log()
Application.ScreenUpdating = False
With Sheets("Log master")
.Visible = True
On Error Resume Next
Set sh = Worksheets(Format(Date, "YYYY-MM-DD"))
On Error Goto 0
If Not sh Is Nothing Then
ans = Msgbox("Sheet already exists - view it?", vbYesNo)
If ans = vbYes Then
sh.ACtivate
End If
Else
.Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = Format(Date, "YYYY-MM-DD")
.Visible = False
End If
End With
Application.ScreenUpdating = True
End Sub

....but on trying this the macro stops and places the error at :

If Not sh Is Nothing Then

Can anybody resole this as I am new and haven't got a clue!
thanks




 
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
error in script from internet explorer fred6529 Excel Discussion (Misc queries) 0 June 11th 05 08:43 PM
Error trapped only while stepping through the code - Not triggered when run Jeff Excel Discussion (Misc queries) 7 March 7th 05 06:29 PM
Error trapped only while stepping through the code - Not triggered when run Jeff Excel Discussion (Misc queries) 0 February 28th 05 06:26 PM
Macro script error - pls help !! Anthony Excel Discussion (Misc queries) 3 February 28th 05 01:49 PM
Script Error Mike Excel Discussion (Misc queries) 1 January 29th 05 12:32 AM


All times are GMT +1. The time now is 10:02 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"