LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Last Column Macro

Thanks for both of your help- with a little tweaking to Bernie's v2
totals macro and Jim's & tip I got my macro working with some
formatting added to it as well. Thanks again for all of your help!

Here's my code:



Sub totals() 'for security reports
Dim EndCell As Range
Dim lastrow

Set EndCell = ActiveSheet.UsedRange
lastrow = EndCell(EndCell.Count).Row

'to fill with totals
EndCell.Offset(EndCell.Rows.Count, 0).Resize(1).FormulaR1C1 = _
"=SUM(R2C:R" + CStr(EndCell.Item(EndCell.Cells.Count).Row) + "C)"

'formatting
Rows(CStr(lastrow + 1) & ":" & CStr(lastrow + 1)).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
With Selection.Interior 'gray background
.ColorIndex = 15
.Pattern = xlSolid
End With

'deleting unneeded subtotals
Range("A" & CStr(lastrow + 1) & ":C" & CStr(lastrow + 1)).Select
Selection.ClearContents
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
Ron DeBruin Macro - Moving Sheet Name from Last Column to Column A ScottMSP Excel Worksheet Functions 7 December 12th 08 06:07 PM
Macro - Insert&Label Column, if the labeled column doesn't exist Jeff[_43_] Excel Programming 1 December 15th 04 09:33 PM
Need Macro to Find Column Heading -- if none, then insert new column Jeff[_43_] Excel Programming 0 December 15th 04 07:08 AM
macro to transpose cells in Column B based on unique values in Column A Aaron J. Excel Programming 3 October 8th 04 02:29 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM


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