doesn't compile, thinks HPageBreak method is a variable
this macro doesn't compile on the HPageBreak. It thinks it is a variable not
a method? What I'm trying to do is force a page break above every department header row. Every lite gray row is a department header. I want a page break at the end of every department range so this should work. Sub SSPPageBreak2() Dim Rng As Range Dim rngToSearch As Range With ActiveSheet Set rngToSearch = .Range(.Range("A1"), .Cells(Rows.Count, "A").End(xlUp)) End With For Each Rng In rngToSearch If Rng.Interior.ColorIndex = 15 Then HPageBreaks.Add befo=.Range Next Rng End Sub |
doesn't compile, thinks HPageBreak method is a variable
ActiveSheet.HPageBreaks.Add Befo=rng
-- Regards, Tom Ogilvy "Janis" wrote: this macro doesn't compile on the HPageBreak. It thinks it is a variable not a method? What I'm trying to do is force a page break above every department header row. Every lite gray row is a department header. I want a page break at the end of every department range so this should work. Sub SSPPageBreak2() Dim Rng As Range Dim rngToSearch As Range With ActiveSheet Set rngToSearch = .Range(.Range("A1"), .Cells(Rows.Count, "A").End(xlUp)) End With For Each Rng In rngToSearch If Rng.Interior.ColorIndex = 15 Then HPageBreaks.Add befo=.Range Next Rng End Sub |
All times are GMT +1. The time now is 12:45 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com