Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default blank row macro with page breaks


I don't know where to start, so here goes. I'm still in the very earl
stages of learning, and I have this code from a previous post tha
Trevor had given me. What it does is go through column B (which is m
Part Number Column) and when there's a different part number it puts
blank row. The problem is that it will sometimes have one set of par
numbers on the bottom of page 1 and the rest of the same part number o
the top of page 2. Is there some kind of edit to this code that can b
made that will keep it from doing that? something like if theres goin
to be a page break in the middle then put more rows than one so that th
set of numbers starts on the second line of the next page? (the reaso
I say second line is so there's a space between the header I have o
every page and the numbers) Please help., Thanks in advance. DKY

Sub test()
Dim LastRow As Long
Dim i As Long
LastRow = Range("B65536").End(xlUp).Row
Application.ScreenUpdating = False
For i = LastRow To 2 Step -1
If Range("B" & i).Value < _
Range("B" & i - 1).Value Then
Range("B" & i).EntireRow.Insert
End If
Next 'i
Application.ScreenUpdating = True
End Su

--
DK
-----------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...fo&userid=1451
View this thread: http://www.excelforum.com/showthread.php?threadid=27151

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default blank row macro with page breaks

The code does nothing with pagebreaks. You would need to determine where
the pagebreaks are on each insertion and then see how many rows need to be
inserted if there is a problem. This would need to be done from the first
row to the last row and you are moving from the last to the first, so you
would probably need to do that in a separate loop.

You could just put in a pagebreak at each change in part number. Do you
want to do that?

--
Regards,
Tom Ogilvy

"DKY" wrote in message
...

I don't know where to start, so here goes. I'm still in the very early
stages of learning, and I have this code from a previous post that
Trevor had given me. What it does is go through column B (which is my
Part Number Column) and when there's a different part number it puts a
blank row. The problem is that it will sometimes have one set of part
numbers on the bottom of page 1 and the rest of the same part number on
the top of page 2. Is there some kind of edit to this code that can be
made that will keep it from doing that? something like if theres going
to be a page break in the middle then put more rows than one so that the
set of numbers starts on the second line of the next page? (the reason
I say second line is so there's a space between the header I have on
every page and the numbers) Please help., Thanks in advance. DKY

Sub test()
Dim LastRow As Long
Dim i As Long
LastRow = Range("B65536").End(xlUp).Row
Application.ScreenUpdating = False
For i = LastRow To 2 Step -1
If Range("B" & i).Value < _
Range("B" & i - 1).Value Then
Range("B" & i).EntireRow.Insert
End If
Next 'i
Application.ScreenUpdating = True
End Sub


--
DKY
------------------------------------------------------------------------
DKY's Profile:

http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=271517



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
When automatic page breaks are moved each cell becomes a new page Queso hotmail com> Excel Discussion (Misc queries) 0 March 30th 10 03:08 AM
Vertical page breaks won't drag in Page Break Preview Caroline Excel Discussion (Misc queries) 0 July 14th 09 12:19 PM
How do I do page breaks when view menu doesnt page break preview HeatherF55 Excel Discussion (Misc queries) 0 September 21st 07 04:24 AM
Page Breaks- Printing selected rows on same page ToddEZ Excel Discussion (Misc queries) 1 July 18th 07 04:38 PM
Macro to insert page breaks when values in 1 or more columns changes Michael G Excel Programming 5 October 3rd 03 01:48 AM


All times are GMT +1. The time now is 10:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"