VBA & HPageBreak

M

myname

Hello,

I'm trying to modify one of my breakpages through VBA:

With ws ' ws is the worksheet I'm working on
.Cells(1, 1) = "YO" ' Just to check something happens
.HPageBreaks(1).Location = .Range("A41")
End With

"YO" is correctly displayed in Cells(1,1) but my breakpage won't move !?!

Any idea why ?

Thanks !
 
C

Chip Pearson

Try

With WS ' ws is the worksheet I'm
working on
.Cells(1, 1) = "YO" ' Just to check something
happens
On Error Resume Next
.HPageBreaks(1).Delete
On Error GoTo 0
.HPageBreaks.Add before:=Range("A41")
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Top