Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a VB sheet that has multiple (in the example below I have 3) different
check boxes. When the user checks the different boxes and then presses a button on the form I want to assemble the different Sheets (named as ShtNumber1, ShtNumber2 and ShtNumber3) below into a print array. I have tried this multiple ways and can get it to work if it is hard-coded to the equivalent of this assembled array, but it will not print. Please notice that I am appending a ", " on the end of each selected sheet name, so at the end of this code I trim it off of the end . Any help or better way to accomplish this would be greatly appreciated. Thank you. Dim PrintArray As String Dim ArrayLength As Integer 'Set to array to blank PrintArray = "" 'Check the individual values for true ' If CheckBox1 = True Then PrintArray = PrintArray & "ShtNumber1.Name, " ' End If ' If CheckBox2 = True Then PrintArray = PrintArray & "ShtNumber2.Name, " ' End If ' If CheckBox3 = True Then ' PrintArray = PrintArray & "ShtNumber2.Name, " ' End If ArrayLength = Len(PrintArray) If ArrayLength 2 Then €˜Gets rid of comma and space PrintArray = Left(PrintArray, ArrayLength - 2) Else End If Sheets(Array(PrintArray)).Select ActiveWindow.SelectedSheets.PrintOut |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
XL2007 and array of sheet names? | Excel Discussion (Misc queries) | |||
Passing sheet names to an array | Excel Programming | |||
Array of all selected sheet names? | Excel Programming | |||
printing sheet names | Excel Worksheet Functions | |||
Sheet Names Array | Excel Programming |