Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 477
Default R/T 438 on .HPageBreaks.Add line

error: Object doesn't support this prop or method... I don't understand..

Public Sub PrintOnly10() 'Rows set (in page setuup) at top to repeat $4:$4

Dim i As Long
Dim MyRange As Range
Dim MyRange1 As Range
Set MyRange = Range("A5").CurrentRegion 'A5 is first row of data
Set MyRange1 = MyRange.Offset(1, 0).Resize(MyRange.Rows.Count - 1, 9)
With MyRange1
For i = 29 To .Rows.Count Step 10
.HPageBreaks.Add .Cells(i, 1) '<< Getting R/T 438
Next i
End With
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default R/T 438 on .HPageBreaks.Add line

Jim,

Try replacing this line

..HPageBreaks.Add .Cells(i, 1)

with this:

..Parent.HPageBreaks.Add .Cells(i, 1)


--
Hope that helps.

Vergel Adriano


"Jim May" wrote:

error: Object doesn't support this prop or method... I don't understand..

Public Sub PrintOnly10() 'Rows set (in page setuup) at top to repeat $4:$4

Dim i As Long
Dim MyRange As Range
Dim MyRange1 As Range
Set MyRange = Range("A5").CurrentRegion 'A5 is first row of data
Set MyRange1 = MyRange.Offset(1, 0).Resize(MyRange.Rows.Count - 1, 9)
With MyRange1
For i = 29 To .Rows.Count Step 10
.HPageBreaks.Add .Cells(i, 1) '<< Getting R/T 438
Next i
End With
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default R/T 438 on .HPageBreaks.Add line

..Hpagebreaks is used with the worksheet--not the range.

With MyRange1
For i = 29 To .Rows.Count Step 10
.Parent.HPageBreaks.Add .Cells(i, 1) '<< Getting R/T 438
Next i
End With

is one way around it.

.Cells(i, 1).PageBreak = xlPageBreakManual

Is another way.

Jim May wrote:

error: Object doesn't support this prop or method... I don't understand..

Public Sub PrintOnly10() 'Rows set (in page setuup) at top to repeat $4:$4

Dim i As Long
Dim MyRange As Range
Dim MyRange1 As Range
Set MyRange = Range("A5").CurrentRegion 'A5 is first row of data
Set MyRange1 = MyRange.Offset(1, 0).Resize(MyRange.Rows.Count - 1, 9)
With MyRange1
For i = 29 To .Rows.Count Step 10
.HPageBreaks.Add .Cells(i, 1) '<< Getting R/T 438
Next i
End With
End Sub


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 477
Default R/T 438 on .HPageBreaks.Add line

Right on; But why the Parent?


"Vergel Adriano" wrote:

Jim,

Try replacing this line

.HPageBreaks.Add .Cells(i, 1)

with this:

.Parent.HPageBreaks.Add .Cells(i, 1)


--
Hope that helps.

Vergel Adriano


"Jim May" wrote:

error: Object doesn't support this prop or method... I don't understand..

Public Sub PrintOnly10() 'Rows set (in page setuup) at top to repeat $4:$4

Dim i As Long
Dim MyRange As Range
Dim MyRange1 As Range
Set MyRange = Range("A5").CurrentRegion 'A5 is first row of data
Set MyRange1 = MyRange.Offset(1, 0).Resize(MyRange.Rows.Count - 1, 9)
With MyRange1
For i = 29 To .Rows.Count Step 10
.HPageBreaks.Add .Cells(i, 1) '<< Getting R/T 438
Next i
End With
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default R/T 438 on .HPageBreaks.Add line

Hi Jim,

Parent because HPageBreaks is a member of the worksheet object, and not the
range. Since you were working with the range object, you needed refer to
it's parent which is the worksheet object.

--
Hope that helps.

Vergel Adriano


"Jim May" wrote:

Right on; But why the Parent?


"Vergel Adriano" wrote:

Jim,

Try replacing this line

.HPageBreaks.Add .Cells(i, 1)

with this:

.Parent.HPageBreaks.Add .Cells(i, 1)


--
Hope that helps.

Vergel Adriano


"Jim May" wrote:

error: Object doesn't support this prop or method... I don't understand..

Public Sub PrintOnly10() 'Rows set (in page setuup) at top to repeat $4:$4

Dim i As Long
Dim MyRange As Range
Dim MyRange1 As Range
Set MyRange = Range("A5").CurrentRegion 'A5 is first row of data
Set MyRange1 = MyRange.Offset(1, 0).Resize(MyRange.Rows.Count - 1, 9)
With MyRange1
For i = 29 To .Rows.Count Step 10
.HPageBreaks.Add .Cells(i, 1) '<< Getting R/T 438
Next i
End With
End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 477
Default R/T 438 on .HPageBreaks.Add line

Thanks Vergel !!


"Vergel Adriano" wrote:

Hi Jim,

Parent because HPageBreaks is a member of the worksheet object, and not the
range. Since you were working with the range object, you needed refer to
it's parent which is the worksheet object.

--
Hope that helps.

Vergel Adriano


"Jim May" wrote:

Right on; But why the Parent?


"Vergel Adriano" wrote:

Jim,

Try replacing this line

.HPageBreaks.Add .Cells(i, 1)

with this:

.Parent.HPageBreaks.Add .Cells(i, 1)


--
Hope that helps.

Vergel Adriano


"Jim May" wrote:

error: Object doesn't support this prop or method... I don't understand..

Public Sub PrintOnly10() 'Rows set (in page setuup) at top to repeat $4:$4

Dim i As Long
Dim MyRange As Range
Dim MyRange1 As Range
Set MyRange = Range("A5").CurrentRegion 'A5 is first row of data
Set MyRange1 = MyRange.Offset(1, 0).Resize(MyRange.Rows.Count - 1, 9)
With MyRange1
For i = 29 To .Rows.Count Step 10
.HPageBreaks.Add .Cells(i, 1) '<< Getting R/T 438
Next i
End With
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
HPageBreaks.Add Stephen Plotnick Excel Programming 2 July 7th 07 01:41 AM
HPageBreaks.Add GeorGeorGe Excel Worksheet Functions 0 February 9th 05 09:31 PM
More HpageBreaks Strangeness BillzyBop Excel Programming 0 June 23rd 04 03:40 AM
Can't set manual HPageBreaks J.E. McGimpsey Excel Programming 0 July 15th 03 03:52 PM
Can't set manual HPageBreaks J.E. McGimpsey Excel Programming 1 July 14th 03 08:12 PM


All times are GMT +1. The time now is 11:18 AM.

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

About Us

"It's about Microsoft Excel"