LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA to place sheet name in cell

the code worked fine for me when used on any sheet that was active.

Produced the correct name.

--
Regards,
Tom Ogilvy

"Hammer_757" wrote
in message ...

I spoke too soon :(

Starting with Tom's sugestion, I came up with the following which works
fine as long as I am on the first worksheet:

Sub SheetNumberUpdate()

'Updates sheet number cell to match sheet (tab) name

ActiveSheet.Range("E54").Font.Bold = False
'clears cell formating

ActiveSheet.Range("E54").Value = "Sheet " & ActiveSheet.Name
'copies worksheetname to cell "Sheet #####"

ActiveSheet.Range("E54").Characters(1, 5).Font.Bold = True
'sets the word "Sheet" to bold font

End Sub

However, when I use it on one of the other worksheets, say sheet 5 or
6, the cell is updated with the sheet name from the first worksheet. I
thought by using Activesheet. Range and Activesheet.name and making sure
the desired sheet is active this would work. what am I missing?


--
Hammer_757
------------------------------------------------------------------------
Hammer_757's Profile:

http://www.excelforum.com/member.php...fo&userid=7413
View this thread: http://www.excelforum.com/showthread...hreadid=400037



 
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
Use a range value in place of sheet name John Wilson Excel Discussion (Misc queries) 1 February 26th 08 08:46 AM
Automatically place text in one cell into cell in another sheet Jack Frost New Users to Excel 2 April 13th 07 03:11 AM
how do I place the sheet tab name in my spreadsheet by formula? DRHannay Excel Worksheet Functions 3 August 2nd 06 04:44 PM
Is there a formula that will place the sheet name in a cell? Reed Excel Worksheet Functions 7 January 20th 05 01:29 AM
How do i place a graphic BEHIND an excel sheet? DangerMouse114[_4_] Excel Programming 4 May 25th 04 08:48 AM


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