Link to home
Create AccountLog in
Avatar of Pearlyn Tan
Pearlyn Tan

asked on

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!
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Pearlyn Tan
Pearlyn Tan

ASKER

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.
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.