Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I think you should be able to pass on a collection. I had this as the code behind a userform:Private Sub CommandButton1_Click() Dim x As New Collection For i = 0 To ListBox1.ListCount - 1 If ListBox1.Selected(i) Then x.Add Sheets(ListBox1.List(i)) Next i blah x End Sub Private Sub UserForm_Initialize() For Each Sht In ThisWorkbook.Sheets ListBox1.AddItem Sht.Name Next Sht End Suband this in a module: Sub blah(shs) For Each mysht In shs mysht.Activate MsgBox mysht.Name & " active now?" Next mysht End SubNo error, all worked, each sheet that had been selected in the multiselect listbox sheet was activated in turn. -- p45cal *p45cal* ------------------------------------------------------------------------ p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=131480 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Call a sub in a modeless userform from a code module? | Excel Programming | |||
Pass worksheet object name to a class module | Excel Programming | |||
Pass variable from module to userform and back | Excel Programming | |||
Code in userform/worksheet vs. in Module | Excel Programming | |||
How to pass values from a userform to a standard module? | Excel Programming |