I have codes written (as below) that find the word Total in Column B. It then exports the selection to PDF. The word Total is then replaced by Done.
I am trying to find a way to repeat this code until there is no more Total in Column B.
Columns("B:B").Select
Selection.Find(What:="Total", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(-1, -1).Activate
ActiveSheet.Range(Selection, Selection.End(xlUp)).Select
Selection.Resize(, 15).Select
Selection.Offset(, 1).Select
Dim rng As Range
With ActiveSheet
Set rng = Selection
.PageSetup.PrintArea = rng.Address
.PageSetup.Orientation = xlLandscape
.PageSetup.FitToPagesWide = 1
.PageSetup.FitToPagesTall = 999
.PageSetup.PrintTitleRows = "$1:$4"
.PageSetup.LeftMargin = Application.InchesToPoints(0.45)
.PageSetup.RightMargin = Application.InchesToPoints(0.2)
.PageSetup.TopMargin = Application.InchesToPoints(0.25)
.PageSetup.BottomMargin = Application.InchesToPoints(0.25)
.PageSetup.HeaderMargin = Application.InchesToPoints(0.3)
.PageSetup.FooterMargin = Application.InchesToPoints(0.3)
.PageSetup.PaperSize = xlPaperA4
.PageSetup.CenterHorizontally = True
.PageSetup.CenterVertically = False
Selection.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="C:Users\kgs-aizat.kassim\Desktop\" & ActiveCell.Offset(0, -1).Value & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End With
Columns("B:B").Select
Selection.Find(What:="Total", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Value = "Done"
End Sub