Hi
Try this -all userform code:
'******************* top of module**************
Option Explicit
Dim R As Long
Private Sub UserForm_Initialize()
R = ActiveCell.Row
Call FillControls
End Sub
Sub FillControls()
TextBox1.Text = Sheets(1).Cells(R, 1).Text
TextBox2.Text = Sheets(1).Cells(R, 2).Text
ComboBox1.Text = Sheets(1).Cells(R, 3).Value
End Sub
Sub WriteToSheet()
Sheets(1).Cells(R, 1).Value = TextBox1.Text
Sheets(1).Cells(R, 2).Value = TextBox2.Text
Sheets(1).Cells(R, 3).Value = ComboBox1.Text
End Sub
Private Sub CommandButton1_Click()
Call WriteToSheet
If R > 1 Then R = R - 1
Call FillControls
End Sub
Private Sub CommandButton2_Click()
Call WriteToSheet
R = R + 1
Call FillControls
End Sub
HTH. Best wishes Harald
> I have exhausted my search abilities to find an answer to what should be
> a simple question.
[quoted text clipped - 13 lines]
>
> Thank you very much.
Jack Gillis - 31 May 2005 09:44 GMT
Thank you very much Harald.
That seems straightforward enough. I can see where I went wrong. I
thought the individual cells could be referred to by their Row and the
column heading of the database. I suppose the same procedure could be
used in reverse to change the cell values from the form if I ever chose
to do so.
Thanks again.
> Hi
>
[quoted text clipped - 54 lines]
>>
>> Thank you very much.
Harald Staff - 31 May 2005 13:14 GMT
> Thank you very much Harald.
> That seems straightforward enough. I can see where I went wrong.
Glad to hear that. Thanks for the feedback.
> I suppose the same procedure could be
> used in reverse to change the cell values from the form if I ever chose
> to do so.
The provided "WriteToSheet" does just that, the reverse of "FillControls".
Best wishes Harald