I have a long row of data split into cells. Each cell populates a textbox, and I have 20 textboxes (and by assumption I have 20 cells).
The code below is how I populate each textbox…
Private Sub UserForm_Initialize()
Set rng = Worksheets("Risk&Issues").Range("A4")
i = 0: j = 1
txtbox_revri_idnum.Text = rng.Offset(i).Value
txtbox_revri_projname.Text = rng.Offset(i, j).Value: j = j + 1
txtbox_revri_isrefnum.Text = rng.Offset(i, j).Value: j = j + 1
...
txtbox_revri_projname.SetFocus
On the form I have an ‘update’ button which when pressed updates the cells (within the worksheet) with new content from each textbox. The code for the ‘update’ button is below…
Private Sub button_revri_update_Click()
ActiveCell.Value = txtbox_revri_projname.Value
ActiveCell.Offset(0, 1) = txtbox_revri_isrefnum.Value
ActiveCell.Offset(0, 2) = txtbox_revri_riskrefnum.Value
...
End Sub
When I view the worksheet, what I expect to see is an update to each cell which is populating a textbox. However, what I actual get is a new row inserted from wherever I happen to press the mouse on a cell.
Can someone please help?
When you press “next” as shown in the previous question, the value of
iis already set. Based on that question, you can use this