Worksheets

P

Paul W Smith

I am looking to populate a list box on a userform.

I have set it's Row Source to a specific range on a worksheet.

I am trying to make the Row Source Range Dynamic based on two parameters.

I have nine identically formatted workbooks. The first Parameter and I
managed this part, refers to a location (by me using offsets). The second
parameter and is a number needs to refer to which of the nine worksheets to
use.

Can anyone offer any ideas?
 
R

Ron de Bruin

Hi

You can use the sheetindex or if your sheet names are
Sheet1,Sheet2..... the second example

Sub test()
Dim ShNumber
ShNumber = 1
MsgBox Sheets(ShNumber).Range("A1").Value
End Sub

Sub test2()
Dim ShNumber
ShNumber = 1
MsgBox Sheets("Sheet" & ShNumber).Range("A1").Value
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top