2016-10-27 19 views
0

私のコードに2番目のループを追加する必要があります。現在はリストを通って( "Dealer"という名前のシートで "B2"で始まり、リストの各項目ごとに異なるPDFを印刷します)マクロにループを追加する方法

私が必要とする2番目のループは同じにする必要がありますライン。それは、別々のワークシートには、言語のリストを通過し、複数のlagnuagesを持つ各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

あなたが理解している場合は、次の構造が必要です(私はijを使用して、ループ):

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 
関連する問題