How to call a worksheet within VBA

nikdwg7

New Member
Joined
Jan 21, 2010
Messages
3
hi... i created a form in VB 6.5 which has a list box. i want to populate this listbox with a 2 column table created in another worksheet (Sheet1) but same workbook so I can sort the data easily. currently, the data is inputted manually within the code ex:

Private Sub UserForm_Initialize()
Dim Resource_Name As Variant


Resource_Name = VBA.Array("25C092", "33B002", "33B003", "33B004", "33B005", "33B005B01", "33B006", "33B006F01", "33B006F02", "33B006G01", "33B006G02", "33B006G03", "33B007", "33B007A02", "33B009",.......)

This makes it hard to find specific a specific number. I want to be able to show both the number and associated name, sort the data numerically or alphabetically and add rows when needed within Sheet1.
Current VBA.Array only shows numbers, not associated name.
I tried to Set RowSource on form to Sheet1 and the range. Listbox was populated just as I wanted, but query would not work. Currently when user chooses a number from listbox on form, it queries from an sql db.

Any help is much appreciated. Thanks!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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