Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Worksheet tab won't update.

Hello, I have the following code:
Public Sub RMacro()
'This code puts the date in cell B22 formatted as 14-Dec-07.

Dim MyRange As Range
Set MyRange = Worksheets("Sheet1").Range("B22")
MyRange = Range("B22").Value
ActiveSheet.Name = MyRange

End Sub
In a module (Module3), when the user clicks a command button on the
worksheet a macro runs that calls the module.
So far so good, but, instead of changeing the worksheet tab to 14-Dec-07
I get a "runtime error 1004". Indicating I'm trying to rename the worksheet
with an invalid name.
Cell B22 is formatted to display the date as 14-Dec-07, but in the formula
bar the date is displayed as 12/14/2007. Is this a default format that Excel
uses? and how can I workaround that?
Thanks in advance for any help,

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Worksheet tab won't update.

Try this perhaps...

ActiveSheet.Name = Worksheets("Sheet1").Range("B22").Text

--
HTH...

Jim Thomlinson


"Paul3rd" wrote:

Hello, I have the following code:
Public Sub RMacro()
'This code puts the date in cell B22 formatted as 14-Dec-07.

Dim MyRange As Range
Set MyRange = Worksheets("Sheet1").Range("B22")
MyRange = Range("B22").Value
ActiveSheet.Name = MyRange

End Sub
In a module (Module3), when the user clicks a command button on the
worksheet a macro runs that calls the module.
So far so good, but, instead of changeing the worksheet tab to 14-Dec-07
I get a "runtime error 1004". Indicating I'm trying to rename the worksheet
with an invalid name.
Cell B22 is formatted to display the date as 14-Dec-07, but in the formula
bar the date is displayed as 12/14/2007. Is this a default format that Excel
uses? and how can I workaround that?
Thanks in advance for any help,

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Worksheet tab won't update.

BINGO! We have a winner!
Thanks for your help Jim

"Jim Thomlinson" wrote:

Try this perhaps...

ActiveSheet.Name = Worksheets("Sheet1").Range("B22").Text

--
HTH...

Jim Thomlinson


"Paul3rd" wrote:

Hello, I have the following code:
Public Sub RMacro()
'This code puts the date in cell B22 formatted as 14-Dec-07.

Dim MyRange As Range
Set MyRange = Worksheets("Sheet1").Range("B22")
MyRange = Range("B22").Value
ActiveSheet.Name = MyRange

End Sub
In a module (Module3), when the user clicks a command button on the
worksheet a macro runs that calls the module.
So far so good, but, instead of changeing the worksheet tab to 14-Dec-07
I get a "runtime error 1004". Indicating I'm trying to rename the worksheet
with an invalid name.
Cell B22 is formatted to display the date as 14-Dec-07, but in the formula
bar the date is displayed as 12/14/2007. Is this a default format that Excel
uses? and how can I workaround that?
Thanks in advance for any help,

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
Update one worksheet tab to automatically update all other tabs? shoechic1 Excel Worksheet Functions 1 May 24th 09 03:55 PM
Update worksheet Angela[_2_] Excel Discussion (Misc queries) 3 March 23rd 08 05:07 PM
How to update worksheet colours based on worksheet name AG Excel Discussion (Misc queries) 1 June 15th 07 10:09 AM
How do I update worksheet 1 from data on worksheet 2 JR Excel Worksheet Functions 2 May 10th 07 01:34 PM
Update second worksheet with changes in original worksheet ZB Excel Worksheet Functions 0 January 26th 05 06:11 PM


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