Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Editing Macro


Hi, Ive just recorded a macro to perform a subtotal calculation, add a
page break and also set a print range.

This works well however as my spreadsheet will change next week if I
add an extra line in, I want to ammend the code in the macro to ensure
that

a) the page break is always above the very last line of the
subtotalling (ie between the last subtotal and the grand total and
b) that the print area is always set correctly, currently the macro is
showing absolute cell references.

Thanks in advance,

this is my first attempt at macro editing


--
scarlett1
------------------------------------------------------------------------
scarlett1's Profile: http://www.excelforum.com/member.php...o&userid=17495
View this thread: http://www.excelforum.com/showthread...hreadid=389756

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Editing Macro

Dim lrw as Long

lrw = Cells(Rows.COUNT, "A").End(xlUp).Row

will give you the last row used in column A.
Change A to what ever column will have the last entry

than lrw = lrw -1 <<< subtract what ever to get the row you want.
and set the print range to lrw...

you could also use

lrw = Cells(Rows.COUNT, "A").End(xlUp).Offset(-1,0).Row
to set it to 1 row above...
--
steveB

Remove "AYN" from email to respond
"scarlett1" wrote in
message ...

Hi, Ive just recorded a macro to perform a subtotal calculation, add a
page break and also set a print range.

This works well however as my spreadsheet will change next week if I
add an extra line in, I want to ammend the code in the macro to ensure
that

a) the page break is always above the very last line of the
subtotalling (ie between the last subtotal and the grand total and
b) that the print area is always set correctly, currently the macro is
showing absolute cell references.

Thanks in advance,

this is my first attempt at macro editing


--
scarlett1
------------------------------------------------------------------------
scarlett1's Profile:
http://www.excelforum.com/member.php...o&userid=17495
View this thread: http://www.excelforum.com/showthread...hreadid=389756



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
Macro Editing Doug B[_2_] New Users to Excel 4 May 15th 09 09:11 PM
Macro editing Skeeter Excel Discussion (Misc queries) 5 August 6th 07 01:40 AM
Editing a macro Dtmos01 Excel Discussion (Misc queries) 6 April 3rd 07 06:36 PM
Editing a Macro ChuckW Excel Discussion (Misc queries) 1 December 12th 06 07:45 PM
Editing Macro heitorfjr Excel Discussion (Misc queries) 1 January 15th 06 07:02 PM


All times are GMT +1. The time now is 09:52 PM.

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"