How to feth the records one-by-one whenever user click the command button

xlhelp15

Board Regular
Joined
Sep 12, 2014
Messages
113
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
Hi Experts,

Kindly help me to solve this issue that i'm facing now. I've records as listed below in seperate excel sheet and used one userform - placed 2 label and 2 text box and 1 command button. I can able to fetch the first record from the seperate spreadsheet by using the another command button named "Get Info". but unable to move the records from 1 to 2.... with the help of command button named "Next".

My requirement is, whenever user click "Next" button it needs to retrieve one record at a time from the seperate spreadsheet. How to do it using excel VBA?


Date​

ID​

8/14/2014​

2702839​

8/14/2014​

2707403​

8/14/2014​

2710471​

8/14/2014​

2713914​

8/14/2014​

2713914​

8/14/2014​

2714476​

8/14/2014​

2716733​

8/14/2014​

2718770​

8/14/2014​

2718792​

8/14/2014​

2726512​



<TBODY>
</TBODY>
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Thanks much for your guidance, Guru.

This is the code that i'm using to retrieve the records from the Excel sheet named - A2...

Set opnXL = New Excel.Application
Set opnBook = opnXL.Workbooks.Open("C:\Users\karthikh\Documents\A2\A2.xls")
Set opnSheet = opnBook.Worksheets("nf") ' Sheet name in workbook - A2
A2.RepDate.Value = opnSheet.Cells(2, 1).Value
A2.CaseID.Value = opnSheet.Cells(2, 2).Value
Set opnSheet = Nothing
opnBook.Close
Set opnBook = Nothing

'RepDate - As Date - Textbox1
'CaseId - as ID - Textbox2


In my userform, as explained earlier i've used 2 CMDbuttons, 1 - to get records from the sheet - "A2" and another command button is for to view the records one-by-one whenever user clicks command button2.

Please help me...
 
Upvote 0

Forum statistics

Threads
1,213,506
Messages
6,114,024
Members
448,543
Latest member
MartinLarkin

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