View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
LRay67 LRay67 is offline
external usenet poster
 
Posts: 49
Default 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