ok have a work sheet and userform which is populated from worksheet
this is the code i use to populate text boxes
Option Explicit
Dim cl As Range
Private Sub CommandButton1_Click()
'get the next line of data
Set cl = ActiveCell.Offset(1, 0)
'switch off ScreenUpdating to speed up code & prevent flickering
Application.ScreenUpdating = False
cl.Select
'if there is no more data then notify the user & quit
If cl.Value = "" Then
TextBox1.Value = "No more Data"
TextBox2.Value = ""
Exit Sub
Else
'load UserForm with fresh data
TextBox1.Value = cl.Value
TextBox2.Value = cl.Offset(0, 1).Value
TextBox3.Value = cl.Offset(0, 2).Value
TextBox4.Value = cl.Offset(0, 3).Value
End If
'restore ScreenUpdating
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
'select the first cell in the column of data
Set cl = Cells(2, 1)
cl.Select
'enter the required data into the textBoxes
TextBox1.Value = cl.Value
TextBox2.Value = cl.Offset(0, 1).Value
TextBox3.Value = cl.Offset(0, 2).Value
TextBox4.Value = cl.Offset(0, 3).Value
End Sub
how can i use this to also update if i change any data in the text boxes if you see what i mean
cheers
Doug
Bookmarks