คือตอนนี้ผมใช้ Macro Save Sheet "nm4-1", "nm4-2", "nm4-3", "nm4-4", "nm4-5", "nm8-1", "nm8-2", "nm8-3", "nm8-4", "nm8-5"
แต่ปัญหาคือ บางชีทถ้าค่า AA10 = 0 ไม่ต้องการให้เซฟ ผมต้องเพิ่ม Code อย่างไรครับ
Sub Picture2_Click()
Dim wksAllSheets As Variant
Dim wksSheet1 As Worksheet
Dim strFilename As String, strFilepath As String
'Set references up-front
Set wksSheet1 = ThisWorkbook.Sheets("nm4-1")
wksAllSheets = Array("nm4-1", "nm4-2", "nm4-3", "nm4-4", "nm4-5", "nm8-1", "nm8-2", "nm8-3", "nm8-4", "nm8-5")
strFilepath = "N:\U-CM\08 GPC InterPipeline and I-4 TruckLoad and Ole&Aro MatTrans\8.04 MAT (GMM)\8.10.01 Billing\Olefins\Excise Olefins\REPORT EXCISE\"
'Create the full Filename using cells D6, E6 and F6
With wksSheet1
'Assemble the string cell-by-cell, "D6 E6-F6"
strFilename = strFilepath & "report" & Format(Range("O4"), "d-mmm-yyyy") & ".pdf"
End With
' 'Save the Array of worksheets (which will be selected) as a PDF
ThisWorkbook.Sheets(wksAllSheets).Select
wksSheet1.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=strFilename, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
'Make sure all the worksheets are NOT left selected
wksSheet1.Select
End Sub