我需要在我的代码中添加第二个循环。目前,它通过列表进行打印(名为"经销商"从" B2&#34开始;并为列表中的每个项目打印不同的PDF。
我需要的第二个循环必须是相同的行。它必须在单独的工作表中查看语言列表,并重新打印具有多个语言的每个PDF。
对此的任何帮助将不胜感激。我的代码如下....
Dim PathString As String
Sub Print_************_2_ImpactValidationReport()
Application.ScreenUpdating = False
Sheets("Dealer").Select
Range("B2").Select
While Not ActiveCell.Value = Empty
Sheets("ImpactValidationReport").Range("AO1").Value = ActiveCell.Value
Sheets("ImpactValidationReport").Select
'Call ChangeGraphAxis
Range("A4").Select
Sheets("ImpactValidationReport").Select
Application.StatusBar = "Executing - Please be patient..."
Call Print_To_File4(Sheets("ImpactValidationReport").Range("AO1").Value)
Application.StatusBar = False
Sheets("Dealer").Select
ActiveCell.Offset(1, 0).Select
Wend
Sheets("ImpactValidationReport").Select
Application.ScreenUpdating = True
Sheets("ImpactValidationReport").Select
Range("A3").Select
MsgBox "All Completed, Please check Files!"
End Sub
Function Print_To_File4(Dealer As String)
'PathString = ***************************\Reporting\DistrictReports\2_ImpactValidationReport" & DealerGroup & ".pdf"
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, PrintToFile:=True, PrToFileName:=PathString
CurrentDir = ActiveWorkbook.Path
Application.DisplayAlerts = False
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
CurrentDir & "\Reporting\DistrictReports\2_ImpactValidationReport\District_Action_Report_" & Dealer & "_2_ImpactValidationReport_" & Format(Now, "dd-mm-yy") _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
Application.DisplayAlerts = True
End Function
答案 0 :(得分:0)
如果我理解你,你需要以下结构(我使用i
和j
作为增量来控制循环):
i = 1
While Not cells(i,1) = Empty
'check all items
j=1
while not sheets("language").cells(j,1) = Empty
'check all languages for the item
j=j+1
wend
i=i+1
wend