Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile error: Method or data member not found Brian Day Excel Worksheet Functions 0 July 22nd 07 03:20 AM
compile error method or data not fount Janis Excel Programming 4 September 14th 06 01:01 AM
Compile Error: Method or data member not found Nick S[_4_] Excel Programming 0 November 16th 04 04:43 PM
Compile Error: Method or data member not found Nick S[_3_] Excel Programming 2 November 16th 04 02:38 PM
Compile Error: Method or data member not found Nick S[_2_] Excel Programming 1 November 16th 04 11:41 AM


All times are GMT +1. The time now is 07:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"