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: 9
Default My macro won't find the last row !

I am reposting this as I cannot get a reply to my problem. The following
macro is meant to go to the last row and then on the next row (lr+1) make a
totals row. But when I run the macro I get an error message
"application-defined or object-defined error" and it
does to the line

..Range(Cells(lr, "h"), Cells(lr, "o")).Borders.LineStyle = xlContinuous

and after as the problem code.

Can someone help me please ?

Sub MakeTotals()'


' Make Totals for Report (zonderArb) Macro
' Macro recorded 15/06/02 by RAO
' Keyboard Shortcut: Ctrl+Shift+T
' clears borders from rows below total line (row 460) for clean printing
' creates SUM formula and then copies across total line
' creates borders and formats 0.00 where appropriate
' saves worksheet


lr=cells(rows.count,"H").end(xlup).row+1
Worksheets("Report (zonderArb)").Rows("460:660").Borders.linestyle =
xlNone
with workSheets("Report (zonderArb)")
. Range("H" & lr).formula="=sum(h1:h" & lr & ")"
. Range("H" & lr).Copy Range(cells(lr,"I"),cells(lr,"ae"))
. Range(cells(lr,"A"),cells(lr,"g")).borders.LineSty le = xlContinuous
. Range(cells(lr,"h"),cells(lr,"o")).borders.LineSty le = xlContinuous
. Range(cells(lr,"p"),cells(lr,"w")).borders.LineSty le = xlContinuous
. Range(cells(lr,"x"),cells(lr,"ae")).borders.LineSt yle = xlContinuous
. Range("AF" & lr).").borders.LineStyle = xlContinuous

. Range(cells(l4,"M"),cells(lr,"n")).NumberFormat = "0.00"
. Range(cells(l4,"u"),cells(lr,"v")).NumberFormat = "0.00"
. Range(cells(l4,"ac"),cells(lr,"ad")).NumberFormat = "0.00"

. Range("G" & LR)= "Totals"

With . Range("G" & LR).Characters(Start:=1, Length:=7).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With

end with

'Sheets("Instructions").Select
' Range("K61").Select
ActiveWorkbook.Save
End Sub





 
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
Get Macro warning, but can't find Macro Stilla Excel Worksheet Functions 1 January 20th 07 01:27 AM
Find Macro Susana C via OfficeKB.com Excel Discussion (Misc queries) 8 December 11th 06 05:22 PM
change error message when no more for "find" in macro to find swyltm Excel Programming 1 January 13th 06 05:16 PM
cant find a macro [email protected] Excel Programming 3 July 6th 05 06:50 PM
I need to find a macro to find data cut and paste to another colu. Rex Excel Programming 6 December 7th 04 09:22 AM


All times are GMT +1. The time now is 04:44 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"