Copy data from cell in selected row

Premise being you already hook into the Worksheet_Change()-event to show the userform (which I think you do, since it shows “whenever someone enters information into column H), you can store the values in variables as follows:

Create a separate module for global variables:

Public Range1 as Range
Public Range2 as Range

Next, in the Worksheet in which you enter the values in column H:

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 8
        Set Range1 = Me.Cells(Target.Row, 1)
        Set Range2 = Me.Cells(Target.Row, 2)
        UserForm1.Show 'Do the rest from there
    End If
End Sub

Now, if the rest of your script is executed from within the userform or anywhere else, you will still have access to all the information in said cells through Range1 and Range2.

Browse More Popular Posts

Leave a Comment