#1   Report Post  
Dolphinv4
 
Posts: n/a
Default Macro to Name Sheet

Hi,

I want my sheet name to automatically be named as Date(Adj) whereby the Date
will be obtained from cell A1. This is what i did but it don't work. What's
wrong?

Sub New_Month()

Dim myAdjName As String

myAdjName = Format(Range("A1").Value, "mmm") & "(ADJ)"
ActivSheet.Name = myAdjName

End Sub

Thanks!
  #2   Report Post  
Stefi
 
Posts: n/a
Default

You misspelled
ActivSheet.Name = myAdjName

Insert an "e":
ActiveSheet.Name = myAdjName
Regards,
Stefi


€˛Dolphinv4€¯ ezt Ć*rta:

Hi,

I want my sheet name to automatically be named as Date(Adj) whereby the Date
will be obtained from cell A1. This is what i did but it don't work. What's
wrong?

Sub New_Month()

Dim myAdjName As String

myAdjName = Format(Range("A1").Value, "mmm") & "(ADJ)"
ActivSheet.Name = myAdjName

End Sub

Thanks!

  #3   Report Post  
HiArt
 
Posts: n/a
Default


Hi Dolphinv4,

I have had the same problem with Range, the macro looks like it should
work, but doesn't.

The solution is that Range sometimess needs to be in the format
-expression-.range. For your macro try:

myAdjName = Format(*Worksheets(1).*Range("A1").Value, "mmm") & "(ADJ)"

Adjust the Worksheets(x) value accordingly.

HTH

Art


--
HiArt
------------------------------------------------------------------------
HiArt's Profile: http://www.excelforum.com/member.php...o&userid=19953
View this thread: http://www.excelforum.com/showthread...hreadid=472032

  #4   Report Post  
Dolphinv4
 
Posts: n/a
Default

Hi,

the prob is not with the typo. I realised it later and changed but it still
don't work.

Regards,
Dolphin

"Stefi" wrote:

You misspelled
ActivSheet.Name = myAdjName

Insert an "e":
ActiveSheet.Name = myAdjName
Regards,
Stefi


€˛Dolphinv4€¯ ezt Ć*rta:

Hi,

I want my sheet name to automatically be named as Date(Adj) whereby the Date
will be obtained from cell A1. This is what i did but it don't work. What's
wrong?

Sub New_Month()

Dim myAdjName As String

myAdjName = Format(Range("A1").Value, "mmm") & "(ADJ)"
ActivSheet.Name = myAdjName

End Sub

Thanks!

  #5   Report Post  
Dolphinv4
 
Posts: n/a
Default

Hi,

but I need this macro to work in every new sheet created, thus I can't put
in a specific "worksheet" name. I tried using "ActiveSheet" instead but it
doesn't work. Please help!

myAdjName = Format(ActiveSheet.Range("A1").Value, "mmm") & "(ADJ)"
ActiveSheet.Name = myAdjName

Thanks,
Val.
"HiArt" wrote:


Hi Dolphinv4,

I have had the same problem with Range, the macro looks like it should
work, but doesn't.

The solution is that Range sometimess needs to be in the format
-expression-.range. For your macro try:

myAdjName = Format(*Worksheets(1).*Range("A1").Value, "mmm") & "(ADJ)"

Adjust the Worksheets(x) value accordingly.

HTH

Art


--
HiArt
------------------------------------------------------------------------
HiArt's Profile: http://www.excelforum.com/member.php...o&userid=19953
View this thread: http://www.excelforum.com/showthread...hreadid=472032




  #6   Report Post  
Dolphinv4
 
Posts: n/a
Default

Hi,

i just realised it does work after I used "ActiveSheet" in your formula.
Thanks!

Val

"Dolphinv4" wrote:

Hi,

but I need this macro to work in every new sheet created, thus I can't put
in a specific "worksheet" name. I tried using "ActiveSheet" instead but it
doesn't work. Please help!

myAdjName = Format(ActiveSheet.Range("A1").Value, "mmm") & "(ADJ)"
ActiveSheet.Name = myAdjName

Thanks,
Val.
"HiArt" wrote:


Hi Dolphinv4,

I have had the same problem with Range, the macro looks like it should
work, but doesn't.

The solution is that Range sometimess needs to be in the format
-expression-.range. For your macro try:

myAdjName = Format(*Worksheets(1).*Range("A1").Value, "mmm") & "(ADJ)"

Adjust the Worksheets(x) value accordingly.

HTH

Art


--
HiArt
------------------------------------------------------------------------
HiArt's Profile: http://www.excelforum.com/member.php...o&userid=19953
View this thread: http://www.excelforum.com/showthread...hreadid=472032


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
Data Range Mess Karen Charts and Charting in Excel 18 January 14th 06 02:34 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM
MACRO - copy rows based on value in column to another sheet Michael A Excel Discussion (Misc queries) 1 March 5th 05 02:15 AM
2 questions, copying data from sheet to sheet and assigning macro Boris Excel Worksheet Functions 0 December 16th 04 06:11 PM
Macro for multiple charts JS Excel Worksheet Functions 1 November 19th 04 03:44 AM


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