Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Rename Tab with Textbox on Worksheet
How would I rename the tab with a Text Box on a worksheet? Not a
userform I've tried the following doesn't seem to work. Private Sub TextBox127_LostFocus() ActiveSheet.Name = Me.Textbox127.value End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Rename Tab with Textbox on Worksheet
most people would hit ENTER when they're done ...so use the textbox's KEYDOWN
method to check if its been pressed.... Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _ ByVal Shift As Integer) If KeyCode = 13 Then If TextBox1.Value < "" Then On Error Resume Next ActiveSheet.Name = TextBox1.Value On Error GoTo 0 End If End If End Sub "LRay67" wrote: How would I rename the tab with a Text Box on a worksheet? Not a userform I've tried the following doesn't seem to work. Private Sub TextBox127_LostFocus() ActiveSheet.Name = Me.Textbox127.value End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Rename Tab with Textbox on Worksheet
Patrick, thanks for the info.
I am not marco/progrmamer literate, not sure what you are referring to with the textbox's KEYDOWN method. Can you help? This is what I have placed on the individual worksheet (code sheet) Private Sub TextBox127_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _ ByVal Shift As Integer) If KeyCode = 13 Then If TextBox127.value < "" Then On Error Resume Next ActiveSheet.Name = TextBox127.value On Error GoTo 0 End If End If End Sub "Patrick Molloy" wrote: most people would hit ENTER when they're done ...so use the textbox's KEYDOWN method to check if its been pressed.... Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _ ByVal Shift As Integer) If KeyCode = 13 Then If TextBox1.Value < "" Then On Error Resume Next ActiveSheet.Name = TextBox1.Value On Error GoTo 0 End If End If End Sub "LRay67" wrote: How would I rename the tab with a Text Box on a worksheet? Not a userform I've tried the following doesn't seem to work. Private Sub TextBox127_LostFocus() ActiveSheet.Name = Me.Textbox127.value End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Rename Tab with Textbox on Worksheet
looks good.
"LRay67" wrote: Patrick, thanks for the info. I am not marco/progrmamer literate, not sure what you are referring to with the textbox's KEYDOWN method. Can you help? This is what I have placed on the individual worksheet (code sheet) Private Sub TextBox127_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _ ByVal Shift As Integer) If KeyCode = 13 Then If TextBox127.value < "" Then On Error Resume Next ActiveSheet.Name = TextBox127.value On Error GoTo 0 End If End If End Sub "Patrick Molloy" wrote: most people would hit ENTER when they're done ...so use the textbox's KEYDOWN method to check if its been pressed.... Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _ ByVal Shift As Integer) If KeyCode = 13 Then If TextBox1.Value < "" Then On Error Resume Next ActiveSheet.Name = TextBox1.Value On Error GoTo 0 End If End If End Sub "LRay67" wrote: How would I rename the tab with a Text Box on a worksheet? Not a userform I've tried the following doesn't seem to work. Private Sub TextBox127_LostFocus() ActiveSheet.Name = Me.Textbox127.value End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using information from one worksheet, to rename inserted worksheet | Excel Worksheet Functions | |||
Rename the worksheet | Excel Discussion (Misc queries) | |||
Rename Textbox on Worksheets | Excel Programming | |||
Add and rename a worksheet | Excel Programming | |||
Rename worksheet | Excel Programming |