How to pagebreak

  • Thread starter Thread starter Bilal A F
  • Start date Start date
B

Bilal A F

Hello everyone,

My problem is that I need to automate insertion of pagebreak in an excel
document.

I pull data from database and spit it out on an excel sheet and then I want
to write a short VB application or just a macro which insert page breaks at
a particular places which i will mark on excel sheet while spitting out
data.

so this macro/routine should just look through an entire coulmn in excel
sheet and when it found the mark it will just insert the page break
automatically and replace the mark by null.

I dont have enough experience in writing VBA routines. I would be very
thankful if someone can guide me.

Thanks a lot,

Bilal
 
Turn on the macro recorder and insert a pagebreak. Turn it off.

That will give you the syntax for inserting a pagebreak. You can loop
through your cells looking for your mark

Dim cell as Range
for each cell in Range(Range("A1"),Cells(rows.count,1).End(xlup))
if cell.Value = "Mark" then
' code to insert pagebreak
end if
Next
 
Back
Top