Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 30
Default Macro to name sheet tabs

I need a macro that will automatically name the sheet tab the date that I
enter in cell E4 on my worksheet. I tried the following macro:

Sub Worksheet_Change ()
ws.Name = ws.Range("E4").Value
End Sub

It automatically runs when I enter a new date in cell E4, which is good.
What isn't good is that it gives the following error message:

"Compile error: Procedure declaration does not match description of event or
procedure having the same name."

How can I get this macro to work?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Macro to name sheet tabs

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("E4")
Set t = Target
If Intersect(t, r) Is Nothing Then Exit Sub
ActiveSheet.Name = r.Value
End Sub

In the worksheet code area
--
Gary''s Student - gsnu200778


"Bill_S" wrote:

I need a macro that will automatically name the sheet tab the date that I
enter in cell E4 on my worksheet. I tried the following macro:

Sub Worksheet_Change ()
ws.Name = ws.Range("E4").Value
End Sub

It automatically runs when I enter a new date in cell E4, which is good.
What isn't good is that it gives the following error message:

"Compile error: Procedure declaration does not match description of event or
procedure having the same name."

How can I get this macro to work?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 30
Default Macro to name sheet tabs

Excellent! Thank you!
-Bill

"Gary''s Student" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("E4")
Set t = Target
If Intersect(t, r) Is Nothing Then Exit Sub
ActiveSheet.Name = r.Value
End Sub

In the worksheet code area
--
Gary''s Student - gsnu200778


"Bill_S" wrote:

I need a macro that will automatically name the sheet tab the date that I
enter in cell E4 on my worksheet. I tried the following macro:

Sub Worksheet_Change ()
ws.Name = ws.Range("E4").Value
End Sub

It automatically runs when I enter a new date in cell E4, which is good.
What isn't good is that it gives the following error message:

"Compile error: Procedure declaration does not match description of event or
procedure having the same name."

How can I get this macro to work?

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 30
Default Macro to name sheet tabs

Don- thx for the streamlined version too!
-Bill

"Don Guillett" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
if target.address<"$E$4" then exit sub
activesheet.name=target
end sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Bill_S" wrote in message
...
I need a macro that will automatically name the sheet tab the date that I
enter in cell E4 on my worksheet. I tried the following macro:

Sub Worksheet_Change ()
ws.Name = ws.Range("E4").Value
End Sub

It automatically runs when I enter a new date in cell E4, which is good.
What isn't good is that it gives the following error message:

"Compile error: Procedure declaration does not match description of event
or
procedure having the same name."

How can I get this macro to work?





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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sheet Tabs Loris Excel Discussion (Misc queries) 2 October 14th 07 05:51 PM
Sheet Tabs enyaw Excel Discussion (Misc queries) 1 March 5th 07 01:50 PM
How do I change the Excel sheet tab bar to display more sheet tabs Rockie Excel Discussion (Misc queries) 3 August 18th 06 02:29 PM
is there anyway in an excel macro to reorder the sheet tabs from left to right? Daniel Excel Worksheet Functions 2 June 23rd 05 07:34 PM
I want to print out the sheet tabs (sheet names) Sundus Excel Worksheet Functions 3 February 23rd 05 08:34 PM


All times are GMT +1. The time now is 01:13 AM.

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"