Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 26
Default changing tab from another sheet cell

i have tried this but i need the cell to come from sheet 1 not sheet 2


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sNAMECELL As String = "A1"
Const sERROR As String = "Invalid worksheet name in cell "
Dim sSheetName As String

With Target
If Not Intersect(.Cells, Range(sNAMECELL)) Is Nothing Then
sSheetName = Range(sNAMECELL).Value
If Not sSheetName = "" Then
On Error Resume Next
Me.Name = sSheetName
On Error GoTo 0
If Not sSheetName = Me.Name Then _
MsgBox sERROR & sNAMECELL
End If
End If
End With
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default changing tab from another sheet cell

Think the sheet code that you quoted will simply rename the sheet tab
according to what's input into cell A1 or returned via a formula in cell A1.

To install the code into any sheet, just copy the code, then do a
right-click on the sheet tab Choose "View Code". Then paste the code into
the code window. Press Alt+Q to get back to Excel. Test it out by inputting
into A1, say: ItWorks, press Enter. The sheet tab will change to the name:
ItWorks.

The code will prompt if the input in A1 contains either invalid characters
for sheetnames or if the sheetname input already exists.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"duckie" wrote in message
oups.com...
i have tried this but i need the cell to come from sheet 1 not sheet 2


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sNAMECELL As String = "A1"
Const sERROR As String = "Invalid worksheet name in cell "
Dim sSheetName As String

With Target
If Not Intersect(.Cells, Range(sNAMECELL)) Is Nothing Then
sSheetName = Range(sNAMECELL).Value
If Not sSheetName = "" Then
On Error Resume Next
Me.Name = sSheetName
On Error GoTo 0
If Not sSheetName = Me.Name Then _
MsgBox sERROR & sNAMECELL
End If
End If
End With
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 26
Default changing tab from another sheet cell

On Nov 13, 9:29 pm, "Max" wrote:
Think the sheet code that you quoted will simply rename the sheet tab
according to what's input into cell A1 or returned via a formula in cell A1.

To install the code into any sheet, just copy the code, then do a
right-click on the sheet tab Choose "View Code". Then paste the code into
the code window. Press Alt+Q to get back to Excel. Test it out by inputting
into A1, say: ItWorks, press Enter. The sheet tab will change to the name:
ItWorks.

The code will prompt if the input in A1 contains either invalid characters
for sheetnames or if the sheetname input already exists.
--
Max
Singaporehttp://savefile.com/projects/236895
xdemechanik
---"duckie" wrote in message

oups.com...



i have tried this but i need the cell to come from sheet 1 not sheet 2


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sNAMECELL As String = "A1"
Const sERROR As String = "Invalid worksheet name in cell "
Dim sSheetName As String


With Target
If Not Intersect(.Cells, Range(sNAMECELL)) Is Nothing Then
sSheetName = Range(sNAMECELL).Value
If Not sSheetName = "" Then
On Error Resume Next
Me.Name = sSheetName
On Error GoTo 0
If Not sSheetName = Me.Name Then _
MsgBox sERROR & sNAMECELL
End If
End If
End With
End Sub- Hide quoted text -


- Show quoted text -


i have done that but i need a cell in sheet 1 to change the tab on
sheet 2

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default changing tab from another sheet cell

"duckie" wrote
i have done that but i need a cell in sheet 1 to change the tab on
sheet 2


Try posting in .programming if nobody drops by here.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default changing tab from another sheet cell

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sNAMECELL As String = "A1"
Const sERROR As String = "Invalid worksheet name in cell "
Dim sSheetName As String

With Target
If Not Intersect(.Cells, Range(sNAMECELL)) Is Nothing Then
sSheetName = Sheets("Sheet1").Range(sNAMECELL).Value
If Not sSheetName = "" Then
On Error Resume Next
Me.Name = sSheetName
On Error GoTo 0
If Not sSheetName = Me.Name Then _
MsgBox sERROR & sNAMECELL
End If
End If
End With
End Sub


Gord Dibben MS Excel MVP

On Tue, 13 Nov 2007 01:20:13 -0800, duckie wrote:

i have tried this but i need the cell to come from sheet 1 not sheet 2


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sNAMECELL As String = "A1"
Const sERROR As String = "Invalid worksheet name in cell "
Dim sSheetName As String

With Target
If Not Intersect(.Cells, Range(sNAMECELL)) Is Nothing Then
sSheetName = Range(sNAMECELL).Value
If Not sSheetName = "" Then
On Error Resume Next
Me.Name = sSheetName
On Error GoTo 0
If Not sSheetName = Me.Name Then _
MsgBox sERROR & sNAMECELL
End If
End If
End With
End Sub




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 26
Default changing tab from another sheet cell

On Nov 14, 11:45 am, Gord Dibben <gorddibbATshawDOTca wrote:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sNAMECELL As String = "A1"
Const sERROR As String = "Invalid worksheet name in cell "
Dim sSheetName As String

With Target
If Not Intersect(.Cells, Range(sNAMECELL)) Is Nothing Then
sSheetName = Sheets("Sheet1").Range(sNAMECELL).Value
If Not sSheetName = "" Then
On Error Resume Next
Me.Name = sSheetName
On Error GoTo 0
If Not sSheetName = Me.Name Then _
MsgBox sERROR & sNAMECELL
End If
End If
End With
End Sub

Gord Dibben MS Excel MVP



On Tue, 13 Nov 2007 01:20:13 wrote:
i have tried this but i need the cell to come from sheet 1 not sheet 2


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sNAMECELL As String = "A1"
Const sERROR As String = "Invalid worksheet name in cell "
Dim sSheetName As String


With Target
If Not Intersect(.Cells, Range(sNAMECELL)) Is Nothing Then
sSheetName = Range(sNAMECELL).Value
If Not sSheetName = "" Then
On Error Resume Next
Me.Name = sSheetName
On Error GoTo 0
If Not sSheetName = Me.Name Then _
MsgBox sERROR & sNAMECELL
End If
End If
End With
End Sub- Hide quoted text -


- Show quoted text -


thanks for the help
it will only let me change the tab on sheet 1 where i put the code in
i want cell A1 on sheet 1 to change tab on sheet 2

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default changing tab from another sheet cell

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sNAMECELL As String = "A1"
Const sERROR As String = "Invalid worksheet name in cell "
Dim sSheetName As String
With Target
If Not Intersect(.Cells, Range(sNAMECELL)) Is Nothing Then
sSheetName = Range(sNAMECELL).Value
If Not sSheetName = "" Then
On Error Resume Next
Sheets(2).Name = sSheetName
On Error GoTo 0
If Not sSheetName = Sheets(2).Name Then _
MsgBox sERROR & sNAMECELL
End If
End If
End With
End Sub


Gord

On Wed, 14 Nov 2007 01:37:16 -0800, duckie wrote:

thanks for the help
it will only let me change the tab on sheet 1 where i put the code in
i want cell A1 on sheet 1 to change tab on sheet 2


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
Changing sheet reference to cell reference TeeJay Excel Worksheet Functions 3 October 19th 07 11:50 AM
changing a cell to changing the link Jared Excel Worksheet Functions 7 May 8th 06 08:41 AM
Changing Sheet Colour/Color black_steel Excel Discussion (Misc queries) 2 March 23rd 06 09:05 PM
Protect from changing sheet name Sloth Excel Discussion (Misc queries) 6 January 23rd 06 08:27 PM
what is the formula for changing the same cell on different sheet. scotty Excel Worksheet Functions 4 November 17th 04 09:51 PM


All times are GMT +1. The time now is 06:18 PM.

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"