Jeremy4110
Board Regular
- Joined
- Sep 26, 2015
- Messages
- 70
Hi,
I'm trying to help a friend create a Excel workbook so the church can track "Withdraws" and "Deposits". I have most of it completed, but I can't figure out how to "SUM" every 10th cell on the last row and give the results in the last row in the last column. Below is an example of one church member record, it is 10 columns. If another member is added, 10 more columns are added. If I had five members listed I would have a total of 52 columns. The first column lists the dates, the next 50 columns would be the donations for the five members and in the last column to want to sum up the total from the five member records.
The reason I was trying to do a For-Next loop to sum up the last row of every 10th column is because members join and members leave. I want to able to sum the total from the member record regardless of how many there are. I tried many combinations to the code below but I haven't been able to get any of them to work. Will someone please help?
Thanks,
Jeremy
I'm trying to help a friend create a Excel workbook so the church can track "Withdraws" and "Deposits". I have most of it completed, but I can't figure out how to "SUM" every 10th cell on the last row and give the results in the last row in the last column. Below is an example of one church member record, it is 10 columns. If another member is added, 10 more columns are added. If I had five members listed I would have a total of 52 columns. The first column lists the dates, the next 50 columns would be the donations for the five members and in the last column to want to sum up the total from the five member records.
The reason I was trying to do a For-Next loop to sum up the last row of every 10th column is because members join and members leave. I want to able to sum the total from the member record regardless of how many there are. I tried many combinations to the code below but I haven't been able to get any of them to work. Will someone please help?
Thanks,
Jeremy
Rich (BB code):
Sub TEST()
Rich (BB code):
[TABLE="width: 0"]
<tbody>[TR]
[TD]MaxRow = ActiveSheet.UsedRange.Rows.Count[/TD]
[/TR]
[TR]
[TD]MaxCol = ActiveSheet.UsedRange.Columns.Count[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 74"]
<tbody>[TR="bgcolor: transparent"]
[TD] Dim c As Long[/TD]
[/TR]
[TR="bgcolor: transparent"]
[TD] For c = 11 To MaxCol Step 10[/TD]
[/TR]
[TR="bgcolor: transparent"]
[TD] Cells(MaxRow, c).NumberFormat = "General"[/TD]
[/TR]
[TR="bgcolor: transparent"]
[TD] Cells(MaxRow, c) = "=SUM(RC[-9]:RC[-2])"[/TD]
[/TR]
[TR="bgcolor: transparent"]
[TD] Cells(MaxRow, c).NumberFormat = "$#,##0.00;[Red]$#,##0.00"[/TD]
[/TR]
[TR="bgcolor: transparent"]
[TD] Next c[/TD]
[/TR]
</tbody>[/TABLE]
End Sub
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Member[/TD]
[TD]Member
One[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Service[/TD]
[TD]Sun
School[/TD]
[TD]Sun Morning[/TD]
[TD]Sun Evening[/TD]
[TD]Wed
Service[/TD]
[TD]Youth
Event[/TD]
[TD]Special Event[/TD]
[TD]Envelop[/TD]
[TD]Other[/TD]
[TD]Notes[/TD]
[TD]Total[/TD]
[TD]Total[/TD]
[/TR]
[TR]
[TD]1/3/18[/TD]
[TD]50[/TD]
[TD]250[/TD]
[TD]100[/TD]
[TD][/TD]
[TD]500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1/7/18[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]65[/TD]
[TD][/TD]
[TD]750[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1/10/18[/TD]
[TD]25[/TD]
[TD]125[/TD]
[TD]100[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]250[/TD]
[TD]1000[/TD]
[TD]Funeral[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1/17/18[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]30[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Monthly
Total[/TD]
[TD]75[/TD]
[TD]375[/TD]
[TD]200[/TD]
[TD]95[/TD]
[TD]500[/TD]
[TD]750[/TD]
[TD]250[/TD]
[TD]1000[/TD]
[TD][/TD]
[TD]3495[/TD]
[TD]3495[/TD]
[/TR]
</tbody>[/TABLE]
Last edited: