![]() |
Add Delete Hpagebreak Macro
Ash:
Try this one. Sub AddDeleteHpgBks() With ActiveCell.EntireRow If .PageBreak = xlPageBreakManual Then .PageBreak = xlPageBreakNone Else .PageBreak = xlPageBreakManual End If End With End Sub -- Hope this helps Martin Fishlock Please do not forget to rate this reply. "AshMorK" wrote: Hello, How can i get a conditional macro that add/delete a Hpagebreak before the active cell if it not contains/contains a Hpagebreak? I need something like this: Sub AddDeleteHpgBks() If ActiveWindow.SelectedSheets.Activecell???HPageBrea k=true Then ActiveWindow.SelectedSheets.HPageBreaks.Add befo=ActiveCell Else ActiveWindow.SelectedSheets.HPageBreaks.Add befo=ActiveCell End If End Sub Thanks |
Add Delete Hpagebreak Macro
hi,
im able to make the page break mannual. I want to delete that page break and add a new one after 10 cells. im able to add a new one but the old one is not deleted. i tried to change teh location of the page break but results in an com exception. If .PageBreak = XlPageBreak.xlPageBreakManual Then .PageBreak = XlPageBreak.xlPageBreakNone Else .PageBreak = XlPageBreak.xlPageBreakManual excelDRApp.ActiveWindow.SelectedSheets.HPageBreaks .Item(break).Delete() EndIf this statement does not have any affect. Please help "Martin Fishlock" wrote: Ash: Try this one. Sub AddDeleteHpgBks() With ActiveCell.EntireRow If .PageBreak = xlPageBreakManual Then .PageBreak = xlPageBreakNone Else .PageBreak = xlPageBreakManual End If End With End Sub -- Hope this helps Martin Fishlock Please do not forget to rate this reply. "AshMorK" wrote: Hello, How can i get a conditional macro that add/delete a Hpagebreak before the active cell if it not contains/contains a Hpagebreak? I need something like this: Sub AddDeleteHpgBks() If ActiveWindow.SelectedSheets.Activecell???HPageBrea k=true Then ActiveWindow.SelectedSheets.HPageBreaks.Add befo=ActiveCell Else ActiveWindow.SelectedSheets.HPageBreaks.Add befo=ActiveCell End If End Sub Thanks |
All times are GMT +1. The time now is 10:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com