Print Title Row with Variable

Hi I'm looking to print the title row that contains a certain text on each page.

The title row is not always on a fixed row on the sheet (some sheets might have more rows above the title than other sheets), but the title row is always fixed with "Product Information" in column B

With ActiveWorkbook.Sheets("Filtered List")
     LR = .Range("B" & Rows.count).End(xlUp).Row
Set FindRow = .Range("B:B").Find(What:="Product Information", LookIn:=xlValues)

findrownumber = FindRow.Row
     Application.PrintCommunication = False
    With Sheets("Filtered List").PageSetup
        .PrintArea = "A1:G" & LR
        .FitToPagesWide = 1
        .FitToPagesTall = False
        .PrintTitleRows = findrownumber

Open in new window


This doesn't work and I get an error on the printTitleRows line, hope you can help!
Pearlyn TanAsked:
Who is Participating?
 
NorieConnect With a Mentor VBA ExpertCommented:
Try this,
.PrintTitleRows = .Rows(findrownumber).Address

Open in new window

or this.
.PrintTitleRows = .Rows(findrownumber).Address(External:=True

Open in new window


The second code is in case the workbook/sheet names are needed as well as the address.
0
 
Pearlyn TanAuthor Commented:
Hi Norie,

Thanks for your input. Got a runtime error 438 while running the first code (replaced line 11 of my code with yours), it highlighted this line saying 'object doesn't support property or method'. Rather new with VBA so I'm not sure how to fix this.
0
 
Pearlyn TanConnect With a Mentor Author Commented:
Managed to fix it.
.PrintTitleRows = Activesheet.Rows(findrownumber).Address

Open in new window

Thanks Norie!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.