LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro page breaks on column value not row 1 - use value in footer?


Hi, I have seen some posts that are similar, but no one seems to have
the problem that I am having. I will post my macro in this, for anyone
that is interested.

My users get a csv file every month, and we have to clean it up. This
macro does that.

My last issues are this:

1) having the spreadsheet create page breaks whenever the value in
column B changes. Below is just that code.


Code:
--------------------

col = 2
LastRw = ActiveSheet.UsedRange.Rows.Count
For X = 2 To LastRw
If Cells(X, col) < Cells(X - 1, col) And Cells(X, col) < Range("B1") Then
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=Cells(X, col)
End If
Next

--------------------



The problem that I am having, is that my first page is just row 1. I
have row 1 repeat at the top of every page. It does make sense in the
code that this value changes, so it makes a page break. Can anyone help
me to adjust my code so that it will ignore the first row when it makes
the page breaks? The value of B1 will always be the same, so my thought
is to make that "If ...Then" statement include something that says not
if Cells(X, col) = B1. Make sense?

Second issue:

2) I want to take the value in column B, as it will be the same for any
given page due to the above page breaks, and put that in the footer.

I have commented out the code that I was having fun with trying. The
idea is that column B is a box number, and I want to have that box
number in the footer, so that it is easy to see on the sheet. Here is
my page setup code for headers and footers.

As I said, I commented out the right footer where I would put this
code. Any help would be great.



Code:
--------------------

With ActiveSheet.PageSetup
.CenterHeader = "Our Form"
.LeftFooter = Date
.CenterFooter = "Signature __________________________________"
' this is where I want the value -- .RightFooter = "Box Number: " & Column("B:B").Value
End With

--------------------


From the posts I have been reading, you cannot use formulas in the
footer. I wish this was not true. My idea was that many formulas or
functions could work here. Because I break the page on the value in
this column any function that finds the value of any B column cell in
the page could be used in this right footer. Like first or last would
work.

Anyway, if I cannot get this second part, I can still deploy the macro.
I just need to fix the first part.

For anyone who is interested, I will post my code in a reply. It is
too long as one whole post.

Thanks! ;)


--
misscrf
------------------------------------------------------------------------
misscrf's Profile: http://www.excelforum.com/member.php...o&userid=14225
View this thread: http://www.excelforum.com/showthread...hreadid=473865

 
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
Vertical page breaks - one per column Staceyglow Excel Worksheet Functions 1 January 8th 10 11:35 PM
blank row macro with page breaks DKY[_20_] Excel Programming 5 September 28th 05 05:54 PM
blank row macro with page breaks DKY[_19_] Excel Programming 0 October 22nd 04 02:20 PM
blank row macro with page breaks DKY[_18_] Excel Programming 1 October 22nd 04 02:09 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 11:40 PM.

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

About Us

"It's about Microsoft Excel"