Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multi Select List Box
I have a user form containing a multi select list box
based on names of worksheets in a workbook (but not all of them mind). I have written the code when I need to work on all of the selected worksheets at once, ie ThisWorkbook.Sheets(aSheets).Select However what would be the correct syntax (I'm guessing at For Each), to select the chosen sheets one at a time, then loop to the next one. You've probably guessed that there's some stuff going on in between the loop but I'm ok with the VBA for that. I've tried For Each Worksheets.(asheets) in This Workbook but excel didn't like that. It's pitiful I know, so pls don't laugh. Any help is appreciated Thanks, Jacqui FYI The code is as follow Dim i As Integer Dim aSheets() As String Dim lListItem As Long Dim lIndex As Long lIndex = -1 Application.ScreenUpdating = False For lListItem = 0 To LstSheet.ListCount - 1 If LstSheet.Selected(lListItem) Then lIndex = lIndex + 1 ReDim Preserve aSheets(0 To lIndex) aSheets(lIndex) = LstSheet.List(lListItem) End If Next lListItem there's lots of other code in here but I won't bore you with that ElseIf OptPrint.Value = True And lIndex -1 Then Set_Print_Areas this is where I need some help! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multi-select from a dropdown list | Excel Discussion (Misc queries) | |||
Multi Select from Drop List | Excel Discussion (Misc queries) | |||
List Box - Multi Select Issue | Excel Worksheet Functions | |||
how do I select multi values from a list | Excel Discussion (Misc queries) | |||
List Box Multi Select Option | Excel Worksheet Functions |