Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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

  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

We have been here before.

I asked two questions, which you haven't answered.

This is the fourth thread you have started on this topic.

If you want help, you have to play your part.

--

HTH

RP
(remove nothere from the email address if mailing direct)


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



  #3   Report Post  
Anthony
 
Posts: n/a
Default

Hi Bob
.....and I did reply to the last question..see here......
http://www.microsoft.com/office/comm...cel.misc&fltr=

....but nobody has come forward with a reply...hence my frustration!!

Can you help??
thanks

"Bob Phillips" wrote:

We have been here before.

I asked two questions, which you haven't answered.

This is the fourth thread you have started on this topic.

If you want help, you have to play your part.

--

HTH

RP
(remove nothere from the email address if mailing direct)


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




  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Well I see 6 threads started by you on this topic since 17:11 on Sunday.

I gave you code which you say errors. It doesn't for me, yet you do not tell
me what the error is, just open the problem to a wider issue than originally
stated. Couple that with teh responses being scattered over 6 threads are
not endearing you. You are not going to get an answer (from me at least) if
you ignore what I ask and just keep firing off new threads.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Anthony" wrote in message
...
Hi Bob
....and I did reply to the last question..see here......

http://www.microsoft.com/office/comm...cel.misc&fltr=

...but nobody has come forward with a reply...hence my frustration!!

Can you help??
thanks

"Bob Phillips" wrote:

We have been here before.

I asked two questions, which you haven't answered.

This is the fourth thread you have started on this topic.

If you want help, you have to play your part.

--

HTH

RP
(remove nothere from the email address if mailing direct)


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






  #5   Report Post  
Anthony
 
Posts: n/a
Default

Bob,
I thought I had given answers to your questions in the thread I pasted to
you in my last reply, however here they are again
now, in answer to your previous questions, if I create a log for today and
it has not already been done -all is fine, however if I try and create again
a pop up msg box says
"Run-time error 1004
Cannot rename a sheet to the same name as another sheet, a referenced object
libary or a workbook referenced by Visual Basic"

I then click on debug and the ActiveSheet.Name = Format(Date, "DDMMM") part
of the code is highlighted in yellow.
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

I am sorry for posting several times, but I thought my questions had been
'lost' in previous pages and nobody would revisit them. A lesson learnt there
for me then !

are you able to offer any other solutions??
thanks again

"Bob Phillips" wrote:

Well I see 6 threads started by you on this topic since 17:11 on Sunday.

I gave you code which you say errors. It doesn't for me, yet you do not tell
me what the error is, just open the problem to a wider issue than originally
stated. Couple that with teh responses being scattered over 6 threads are
not endearing you. You are not going to get an answer (from me at least) if
you ignore what I ask and just keep firing off new threads.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Anthony" wrote in message
...
Hi Bob
....and I did reply to the last question..see here......

http://www.microsoft.com/office/comm...cel.misc&fltr=

...but nobody has come forward with a reply...hence my frustration!!

Can you help??
thanks

"Bob Phillips" wrote:

We have been here before.

I asked two questions, which you haven't answered.

This is the fourth thread you have started on this topic.

If you want help, you have to play your part.

--

HTH

RP
(remove nothere from the email address if mailing direct)


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









Reply
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 08:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"