I have a workbook with several userforms. When a user fills out the form, the data in inserted into a series of columns in a single row. The next time they use the form, Excel adds the data to the next available row.
Now I want to add the ability for them to edit one of their entries via a form. This time, when the click on the first cell in the row, the userform loads. I've added the following code to the form on Activate:
Private Sub UserForm_Activate()
ActiveSheet.Unprotect
frmEliteEdit.txtGuestName.Value = tbl.Offset(0, 2).Value
frmEliteEdit.txtSaleDate.Value = tbl.Offset(0, 11).Value
End Sub
When the form opens, I want the textboxes and other fields on the form to be populated with the values from that row. So, if they click on the first cell in row 12, the GuestName field should contain the value of the 3rd cell in the row, and SaleDate should contain the value from the 12th cell in the row. However, it simply leaves the form fields blank.
If I change the Offset to (0, 0), the form does load the textbox with the data from the first cell, but it will not work for data in any other columns.
What am I doing wrong?
Now I want to add the ability for them to edit one of their entries via a form. This time, when the click on the first cell in the row, the userform loads. I've added the following code to the form on Activate:
Private Sub UserForm_Activate()
ActiveSheet.Unprotect
frmEliteEdit.txtGuestName.Value = tbl.Offset(0, 2).Value
frmEliteEdit.txtSaleDate.Value = tbl.Offset(0, 11).Value
End Sub
When the form opens, I want the textboxes and other fields on the form to be populated with the values from that row. So, if they click on the first cell in row 12, the GuestName field should contain the value of the 3rd cell in the row, and SaleDate should contain the value from the 12th cell in the row. However, it simply leaves the form fields blank.
If I change the Offset to (0, 0), the form does load the textbox with the data from the first cell, but it will not work for data in any other columns.
What am I doing wrong?