Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I want to copy a SUM formula from a row that is summing 4 rows of data to
another row where I need it to copy 3 rows of data or 5 rows of data. Is there a way for the SUM formula to "auto size"? |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Try this:
Sub ProcessData() Dim LastRow As Long Dim LastCol As Long With ActiveSheet LastRow = .Cells(.Rows.count, "A").End(xlUp).Row LastCol = .Cells(1, .Columns.count).End(xlToLeft).Column ..Cells(LastRow + 1, "A").Resize(, LastCol).Formula = "=Sum(A1:A" & LastRow & ")" End With End Sub Regards, Ryan--- -- RyGuy "Excel Curious" wrote: I want to copy a SUM formula from a row that is summing 4 rows of data to another row where I need it to copy 3 rows of data or 5 rows of data. Is there a way for the SUM formula to "auto size"? |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Is there a formula that can accomplish this rather than VBA?
What I want to do is very similar to a subtotal, but without any common item to subtotal by. EXAMPLE: 1] 7 2] 5 3] 6 4] <SUM formula here for rows 1-3 RESULT 18 5] 2 6] 8 7] <copy above formula from 4, but have SUM rows 5-6 RESULT 10 8] 3 9] <copy above formula from 4, but have SUM row 8 RESULT 3 "ryguy7272" wrote: Try this: Sub ProcessData() Dim LastRow As Long Dim LastCol As Long With ActiveSheet LastRow = .Cells(.Rows.count, "A").End(xlUp).Row LastCol = .Cells(1, .Columns.count).End(xlToLeft).Column .Cells(LastRow + 1, "A").Resize(, LastCol).Formula = "=Sum(A1:A" & LastRow & ")" End With End Sub Regards, Ryan--- -- RyGuy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy and paste versus copy and insert copied cells | New Users to Excel | |||
formulat to convert base 32 to decimal? | Excel Worksheet Functions | |||
Translation Formulat Entry | Excel Worksheet Functions | |||
Copy/Paste how to avoid the copy of formula cells w/o calc values | Excel Discussion (Misc queries) | |||
EXCEL FILE a copy/a copy/a copy ....filename | New Users to Excel |