View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ryan H Ryan H is offline
external usenet poster
 
Posts: 489
Default Use combobox value as sheetname to set sheet object

Set wks = ActiveWorkbook.Sheets(ComboBox1.Text)

Hope this helps! If so, let me know, click "YES" below.
--
Cheers,
Ryan


"Greg Snidow" wrote:

Greetings all. I've got a userform with a combo that is populated with the
workbook sheet names with code I found here...

For Each sh In ActiveWorkbook.Sheets
Me.ComboBox1.AddItem sh.Name
Next

I would like to set a sheet object using combobox1, but I can not figure it
out. Basically this is what I want to do

Dim Ws as worksheet

Set Ws = Activeworkbook.sheet(combobox1).

Now I know this does not work, but I can't figure out how to do it. My
first thought was to have the combo box be 2 columns, one of which would
contain the index number of the sheets in the workbook. Any ideas? Thank
you.

Greg