We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Add a PageBreak into Excel

RichW
RichW asked
on
Medium Priority
830 Views
Last Modified: 2008-09-04
Hi All,

This should be an easy one.  I am trying to add a Pagebreak into an Excel sheet, and for the life of me I can't figure out how to do it.  I am able to create the sheet and add all of my data, but I cannot get the pagebreak to work.

Can someone show me how to add a pagebreak?

VB.Net 2003
Excel 2002

Thanks

RichW
Comment
Watch Question

hey,

in excel vba (99% similar in vb.net):

'this is horizontal so only the number matters (A20 = row 20)
ThisWorkbook.Worksheets.HPageBreaks.Add Range("A20")

'this is vertical so only the letter matters (D1 = column D)
ThisWorkbook.Worksheets.VPageBreaks.Add Range("D1")

this adds the pagebreaks to ALL the worksheets in the open workbook.
use ThisWorkbook.Worksheets(x) to do it on 1 sheet only.

warning though: Excel 2002 could *hang* when using the hpagebreaks.add or/and vpagebreaks.add function. this might or might not be fixed in the current service pack (don't know as i switched to office 2003 before this was fixed).

i hope this helps !
cheers,

Andy

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
AndyAelbrecht,

Thank you.  That worked perfectly!

Thanks again.

RichW
cheers dude, you're welcome ! :-)
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.