Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- LastRowRoutes = VV 'LastRowRoutes & VV are Variant
- Dim M As Variant
- Dim arr() As Variant
- Dim cnt As Variant
- Dim strFilename As String, strFilepath As String
- Dim wksSheet1 As Worksheet
- Dim printSheets As Variant
- printSheets = arr
- Set wksSheet1 = ThisWorkbook.sheets("Sheet1")
- Set wksSheet1 = Worksheets("Sheet1")
- strFilepath = "E:"
- With wksSheet1
- strFilename = strFilepath & "TripSheets_Print.pdf"
- End With
- cnt = 0
- For M = 22 To LastRowRoutes
- If Worksheets(M).Range("B4").Value <> "" Then
- ReDim Preserve arr(0 To cnt)
- arr(cnt) = Worksheets(M).Range("A1:K43")
- cnt = cnt + 1
- Else
- End If
- Next
- ThisWorkbook.sheets(printSheets).Select '*Type Mismatch here
- wksSheet1.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFilename, Quality:=xlQualityStandard, _
- IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
- '@@@@@@@@ code below to view array contents in lieu of select & export
- For M = LBound(arr) To UBound(arr) 'type mismatch here as well
- msg = msg & arr(M) & vbNewLine
- Next M
- MsgBox "the values of my array are: " & vbNewLine & msg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement