Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Ron DeBruin Macro - Moving Sheet Name from Last Column to Column A | Excel Worksheet Functions | |||
Macro - Insert&Label Column, if the labeled column doesn't exist | Excel Programming | |||
Need Macro to Find Column Heading -- if none, then insert new column | Excel Programming | |||
macro to transpose cells in Column B based on unique values in Column A | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming |