Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Inserting rows and after inserting Page Nr

0

Hey all 

Can some help me with this problem I have with coding a macro? 

I'm new at coding macros so can't solve this by myself. 

I have these data in rows I need to separate by inserting a row and afterward i need to insert page number which is in collum B after every information. The pagenumber should be between the data. (see the EX file for an example)

I have this code for now where I can place the page text but not the number from the text. 

If you have some improvements for the code i would also be happy to get that.

Answer
Discuss

Discussion

You seem to see this as a coding problem. It isn't. It's a pagination problem and you won't be able to solve it without understanding how Excel treats pages. A quick way of explaining would have Excel write everything to one page until the page is full, then start a new page. Each worksheet has Headers and Footers. A new Header/Footer is added to each page. Headers/Footers are the same for all pages. Therefore they can't have subtotals. If you want subtotals they must be included in each page's text. However since Excel will start a new page when it runs out of space that is very difficult to do.
Variatus (rep: 4889) Jan 26, '19 at 9:27 pm
Add to Discussion

Answers

0

I put Headings in your data....then try using Subtotals with page break....on the Menus: Data/ in outline group SUBTOTAL/

then at each change in ColB - use Function COUNT - then near the bottom use PAGE BREAK BETWEEN GROUPS (have all 3 check boxes checked) and this will put in the page breaks for you!  (the only issue I saw, was that some of the Groupings will spill on to more than 1 page [ when i did it the 2nd grouping with "2" in  ColB - spilled onto another page.

Discuss

Discussion

Not sure what you mean by headings and page break. Is pretty new to macros so don't know alot about it.
Juul1305 Jan 25, '19 at 2:38 am
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login