Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autonaming tabs


I am looking for a macro to auto name my tabs the contents of cell B9.
The tricking part is the contents of B9 will always have a 0 in front of
it. (0234)

I can get the tab to name itself but it does not bring the 0 with
it....

Any suggestions?


--
Cook
------------------------------------------------------------------------
Cook's Profile: http://www.thecodecage.com/forumz/member.php?userid=107
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=59817

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autonaming tabs


dan dungan;217711 Wrote:
How are you getting the tabs to autoname now?


Yes, just need to modify the code to bring the zero over.

Here is what I have so far.

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("b9")) Is Nothing Then
On Error Resume Next
Me.Name = Range("b9").Value
If Err.Number < 0 Then
MsgBox "Quote sheet has not been named"
End If
On Error GoTo 0
End If


End Sub


--
Cook
------------------------------------------------------------------------
Cook's Profile: http://www.thecodecage.com/forumz/member.php?userid=107
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=59817

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autonaming tabs


Is the cell formatted as number?, maybe change
Code:
--------------------
Me.Name = Range("b9").Value
--------------------
for
Code:
--------------------
Me.Name = Range("b9").Text
--------------------

Cook;217720 Wrote:
Yes, just need to modify the code to bring the zero over.

Here is what I have so far.

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("b9")) Is Nothing Then
On Error Resume Next
Me.Name = Range("b9").Value
If Err.Number < 0 Then
MsgBox "Quote sheet has not been named"
End If
On Error GoTo 0
End If


End Sub



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=59817

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Autonaming tabs

If that 0 is added because you used a custom number format, maybe changing this
line:

Me.Name = Range("b9").Value
to
Me.Name = Range("b9").text

would be enough.



Cook wrote:

dan dungan;217711 Wrote:
How are you getting the tabs to autoname now?


Yes, just need to modify the code to bring the zero over.

Here is what I have so far.

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("b9")) Is Nothing Then
On Error Resume Next
Me.Name = Range("b9").Value
If Err.Number < 0 Then
MsgBox "Quote sheet has not been named"
End If
On Error GoTo 0
End If

End Sub

--
Cook
------------------------------------------------------------------------
Cook's Profile: http://www.thecodecage.com/forumz/member.php?userid=107
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=59817


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Autonaming tabs


Change
Me.Name = Range("b9").Value
to
Me.Name = Range("b9").Text

The Text property returns exactly what is displayed in the cell, with
formatting, while Value gets the underlying, unformatted value.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Fri, 6 Feb 2009 21:22:17 +0000, Cook
wrote:


dan dungan;217711 Wrote:
How are you getting the tabs to autoname now?


Yes, just need to modify the code to bring the zero over.

Here is what I have so far.

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("b9")) Is Nothing Then
On Error Resume Next
Me.Name = Range("b9").Value
If Err.Number < 0 Then
MsgBox "Quote sheet has not been named"
End If
On Error GoTo 0
End If


End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autonaming tabs


You guys are good.... Got it Thanks!!!!


--
Cook
------------------------------------------------------------------------
Cook's Profile: http://www.thecodecage.com/forumz/member.php?userid=107
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=59817

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autonaming tabs


{share}Glad we could be of help!
{share}*Saying thanks.*

* If you have found my tip helpful then please click on the
animated \\"Say Thanks\\" button to the top right of my post to register
your appreciation*


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=59817

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
How do I alphabetize the tabs on a spreadsheet with 25 tabs? Anita Excel Worksheet Functions 0 May 27th 10 10:01 PM
sheet tabs is checked but I can't see my tabs 3091Director Excel Discussion (Misc queries) 2 March 15th 10 03:46 AM
Autonaming tabs dan dungan Excel Programming 4 February 6th 09 10:23 PM
tabs are missing even though 'tools-options-view-sheet tabs' ok? rgranell Excel Worksheet Functions 3 August 16th 08 04:25 PM
hide tabs from view then lock tabs? slowboat Excel Discussion (Misc queries) 1 December 19th 07 07:06 AM


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