LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Anthony
 
Posts: n/a
Default VB error - please help

Hi,
I have the code below that will create a new worksheet and rename it after
todays date. However if the user trys to create a log again , ie for the same
day, I get this error:-
Run-time error 1004
cannot rename a sheet to the same name as another sheet, a referenced object
or a workbook referenced by visual basic.

Oh course what I want is a msg box advising the user that one already
exsists ans asking if they wanna view it.

the code I have


Sub Create_log()
Application.ScreenUpdating = False
With Sheets("Log master")
.Visible = True
.Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = Format(Date, "DDMMM")
.Visible = False
End With
Application.ScreenUpdating = True
End Sub

any help appreciated

 
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 03: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"