"... When I click print, it should print all sheets within range selected in C4 and C5 without me having to select it ..."
But:
For i = StartSheet To EndSheet
Range("SheetIndex") = i
If Range("Preview") Then
ActiveSheet.PrintPreview
Else
ActiveSheet.PrintOut
End If
Next i
Does not actively select nor change the active sheet. Therefore, you get EndSheet - StartSheet number of copies of the same sheet.
The workbook posted has various sheets numbered from 1 to 87 so I don't know what the i-loop is refering to. There is no indication that #i should activate a particular sheet by name or by number. For instance there is no sheet2...
For some reason you have combobox1 with:
BoundColumn @ 2
ColumnCount @ 2
ColumnWidths @16,16 which is to narrow to show the selection
HideSelection =True (?)
ListFillRange = error since you did not include that sheet in the sample
TextColumn @ 2
If you want the combobox items linked to member names (tabs) you can use:
Private Sub Workbook_Open()
Application.DisplayCommentIndicator = xlCommentIndicatorOnly
Application.EnableEvents = False
Dim x
With Sheets("Form").ComboBox1
.ListFillRange = ""
.LinkedCell = ""
.Clear
End With
'Dropdown list filled with member names only
For Each x In ThisWorkbook.Worksheets
If x.Name <> "Form" _
And x.Name <> "HelpSheet" _
And x.Name <> "helpmod" _
And x.Name <> "printmod" Then
Sheets("Form").ComboBox1.AddItem x.Name
End If
Next x
Application.EnableEvents = True
End Sub
You need to determine which sheets you want to print. (Probably based on sheet names). That Fir i..Next i loop isn't going to work as written.
Form sheet code mod:
Private Sub ComboBox1_Change()
Sheets("Form").Cells(3, 3).Value = ComboBox1.ListIndex
Sheets("form").Range("L1").Value = ComboBox1.Value
End Sub
Bookmarks