Hi
In Gen Module
Thanks NimishK
In Gen Module
Code:
Option Explicit
Public curRec As Integer
Public a$()
Public b$()
'------------------
in Userform1
Private Sub UserForm_Initialize()
curRec = 1
ReDim a$(1 To 15)
ReDim b$(1 To 15)
With Sheets("Sheet1")
Userform1.textBox1.Text = .Cells(2, 3).Value
Userform1.textBox2.Text = .Cells(2, 4).Value
'The above reads the value in respective textbox from Sheet1
'FYI my range of data is from Column C to G and Row starts from 2
End with
End Sub
Private Sub cmdNext_Click()
If curRec < 15 Then
A$(curRec) = Userform1.textBox1.Text
B$(curRec) = Userform1.textBox2.Text
curRec = curRec + 1
If curRec > UBound(A$) Then ReDim Preserve A$(1 To curRec)
If curRec > UBound(B$) Then ReDim Preserve B$(1 To curRec)
Userform1.textBox1.Text = A$(curRec)
Userform1.textBox2.Text = B$(curRec)
'What needs to be done here so that i am able to read the respective data from 15 Cells of each row in a particular column of sheet by pressing next button in respective text boxes
End If
End Sub
Thanks NimishK
Last edited: