G
Gary Keramidas
i have this code assigned to a button on each sheet
Private Sub CommandButton1_Click()
UserForm1.Show
End Sub
then i want to set 2 values on the form when the button is clicked. i fill
the combo box with the active sheet name (it is a drop down of the 12 month
names, one for each sheet) and i put the line number it is going to enter
the record on right below that in a text box.
Private Sub UserForm_Activate()
Set ws = ActiveSheet
iRow = ws.Cells(Rows.Count, "B") _
.End(xlUp).Offset(1, 0).Row
UserForm1.TextBox1.Value = "Line Item # " & iRow - 3
UserForm1.ComboBox1.Value = ActiveSheet.Name
Me.LSite.SetFocus
End Sub
it mostly works, but i want the focus to be in the first field, LSite, but
the form is not even active after i click the macro button. after i click
the form to make it the active window, the cursor is still not in the LSite
field.
how do i get around this behavior?
Private Sub CommandButton1_Click()
UserForm1.Show
End Sub
then i want to set 2 values on the form when the button is clicked. i fill
the combo box with the active sheet name (it is a drop down of the 12 month
names, one for each sheet) and i put the line number it is going to enter
the record on right below that in a text box.
Private Sub UserForm_Activate()
Set ws = ActiveSheet
iRow = ws.Cells(Rows.Count, "B") _
.End(xlUp).Offset(1, 0).Row
UserForm1.TextBox1.Value = "Line Item # " & iRow - 3
UserForm1.ComboBox1.Value = ActiveSheet.Name
Me.LSite.SetFocus
End Sub
it mostly works, but i want the focus to be in the first field, LSite, but
the form is not even active after i click the macro button. after i click
the form to make it the active window, the cursor is still not in the LSite
field.
how do i get around this behavior?