ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,726
- Office Version
- 2007
- Platform
- Windows
Morning,
I am using the code supplied below.
When i open my workbook the userform called DiscoForm opens.
There are 7 Textboxes but i only need to concentrate on 5 of them.
What i am trying to do is have the code select the next TextBox once a value is entered in the previous TextBox
So a user enters a value in TextBox 1 then have the code select TextBox2
The pattern follows etc Value in TextBox2 then select TextBox3 etc etc
The value will either be 1 letter or 1 number
I have started below but then hit a wall as the TextBox didnt get selected.
Hitting enter on keybord does select the next TextBox if that helps you.
Thanks
I am using the code supplied below.
When i open my workbook the userform called DiscoForm opens.
There are 7 Textboxes but i only need to concentrate on 5 of them.
What i am trying to do is have the code select the next TextBox once a value is entered in the previous TextBox
So a user enters a value in TextBox 1 then have the code select TextBox2
The pattern follows etc Value in TextBox2 then select TextBox3 etc etc
The value will either be 1 letter or 1 number
I have started below but then hit a wall as the TextBox didnt get selected.
Hitting enter on keybord does select the next TextBox if that helps you.
Thanks
Rich (BB code):
Private Sub SendToWorksheet_Click()
If TextBox1.Value <> 0 Then
TextBox2.SetFocus Focus
If TextBox2.Value <> 0 Then
TextBox3.SetFocus Focus
If TextBox3.Value <> 0 Then
TextBox4.SetFocus Focus
If TextBox4.Value <> 0 Then
TextBox5.SetFocus Focus
ThisWorkbook.Worksheets("Sheet1").Range("P6") = Me.TextBox1.Text
ThisWorkbook.Worksheets("Sheet1").Range("Q6") = Me.TextBox2.Text
ThisWorkbook.Worksheets("Sheet1").Range("R6") = Me.TextBox3.Text
ThisWorkbook.Worksheets("Sheet1").Range("S6") = Me.TextBox4.Text
ThisWorkbook.Worksheets("Sheet1").Range("T6") = Me.TextBox5.Text
ThisWorkbook.Worksheets("Sheet1").Range("U6") = Me.TextBox6.Text
ThisWorkbook.Worksheets("Sheet1").Range("P7") = Me.TextBox7.Text
ActiveWorkbook.Save
Application.ScreenUpdating = True
Unload Me
Dim answer As Long
Dim currentShape As Shape
Sheets("Sheet1").Range("P6:U6").Copy Sheets("Sheet1").Range("E6")
Sheets("Sheet1").Range("P7").Copy Sheets("Sheet1").Range("E7")
Sheets("Sheet1").Range("E6:J6").Copy Sheets("PRINT LABELS").Range("E5")
Sheets("Sheet1").Range("E7").Copy Sheets("PRINT LABELS").Range("E6")
Sheets("Sheet1").Activate
ActiveSheet.Range("E7").Select
Application.ScreenUpdating = False
With Sheets("PRINT LABELS")
.Range("M1").ClearContents
For Each currentShape In .Shapes
If currentShape.Type = msoPicture Then
currentShape.Delete
End If
Next currentShape
End With
Application.ScreenUpdating = True
ActiveWorkbook.Save
With Sheets("PRINT LABELS")
.Activate
.Range("A1").Select
ActiveWorkbook.FollowHyperlink Address:="http://www.reeves.tv/mini.html"
End With
End Sub