I have a worksheet that is composed of 928 individual packing lists. I am stumped on writing a "do while" formula in macros to search for " Packing List" and then insert a page break before the active cell. I have looked everywhere online and even went and bought excel for dummies and the formulas and functions for dummies! All to no avail. On the sheet I went to Column I and wrote a formula to count all "Packing List" within the worksheet. then wrote the following script.
Dim PackingList As Integer
Dim i As Long
Dim r As Long
PackingList = Range("i1").Value
i = 2
r = 2
Do While i <= PackingList
If Cells(r, 1).Value = "Packing List" Then
Rows(r).PageBreak = xlPageBreakManual
i = i + 1
r = r + 1
It errors out.
Please someone point me to my errors!