I want my userform to initially populate with the data from the row's active cell on the same sheet. I'm using a command button to open the userform and I have a scrollbar on the userform to change between the records (spreadsheet rows) on the form.
I've tried several things but I can't get the form to populate with the data from the active cell when the userform opens. It will populate properly when I change the records with the scrollbar but always initially opens with blanks instead of the desired data from the row of the active cell.
Here is one of my latest attempts:
The scrollbar is not taking the value of eRow nor setting the maximum value.
I don't see any event for scrollbar that might enable this and I'm not sure how to pass the desired value properly.
Actually I'm not sure the event is being seen since I changed the name of the userform to EmpUserForm and I get errors if I try to change it back to simply UserForm.
I've tried several things but I can't get the form to populate with the data from the active cell when the userform opens. It will populate properly when I change the records with the scrollbar but always initially opens with blanks instead of the desired data from the row of the active cell.
Here is one of my latest attempts:
Code:
<code>Private Sub EmpUserForm_Initialize()
Dim eRow As Long
If ActiveCell.Row > 3 And ActiveCell.Row < 104 Then
eRow = ActiveCell.Row
Else eRow = 4
End If
ScrollBar1.Max = WorksheetFunction.CountA(Range("eSS")) ActiveSheet.ScrollBars("ScrollBar1").Value = eRow
...more code</code>
I don't see any event for scrollbar that might enable this and I'm not sure how to pass the desired value properly.
Actually I'm not sure the event is being seen since I changed the name of the userform to EmpUserForm and I get errors if I try to change it back to simply UserForm.