View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default 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