litestream
Active Member
- Joined
- Jul 24, 2006
- Messages
- 323
I've got my code up and running now, but is it possible to insert another worksheet and rename it as the value of TextBox1 if the worksheet doesn't exist? And how about if a worksheet with that name already exists?
My code is:
Private Sub UserForm_Initialize()
LastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("A1:A" & LastRow).Name = "ListName"
ComboBox1.RowSource = "ListName"
End Sub
Private Sub ComboBox1_Change()
Dim BatchLet As String
With ComboBox1
TextBox1.Text = Range(.RowSource).Cells(.ListIndex + 1, 2)
BatchLet = TextBox1.Value
TextBox2.Value = Sheets(BatchLet).Select
TextBox2.Value = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Value
End With
End Sub
My code is:
Private Sub UserForm_Initialize()
LastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("A1:A" & LastRow).Name = "ListName"
ComboBox1.RowSource = "ListName"
End Sub
Private Sub ComboBox1_Change()
Dim BatchLet As String
With ComboBox1
TextBox1.Text = Range(.RowSource).Cells(.ListIndex + 1, 2)
BatchLet = TextBox1.Value
TextBox2.Value = Sheets(BatchLet).Select
TextBox2.Value = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Value
End With
End Sub