How to get the respective data from 15 Cells of each row in a praticular column of sheet by pressing next button in User form in respective textboxes

NimishK

Well-known Member
Joined
Sep 4, 2015
Messages
688
Hi

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:
U can edit the textboxes and transfer the edited data with the code posted!! Spin your button to the desired cell address, change the value in the textbox, select command1 to enter it to the array. Now select option button1 to review what's on the sheet. Select option button2 to see what's in the array. Select command2 to transfer the contents of the array to sheet2. The sheets MUST be named sheet1 and sheet2 or U will have to find and replace the sheet names in code to adjust to your sheet names. Changing the array values does not change the values in sheet1.I've almost got the individual column editing completed... again do to U want to transfer them as a contiguous array or in separate columns to separate locations? Dave
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,224,826
Messages
6,181,192
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top