VBA & HPageBreak

  • Thread starter Thread starter myname
  • Start date Start date
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 !
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top