Hey all,
I'm new to this forum and relatively new to VBA. I'm currently working on a project and I'm trying to code the following, but I'm having difficulty.
My data is a static table. The first column it titled Year and goes from 2011 to 2015. The columns thereafter are titled with 6 digit codes which correspond to account numbers under which is an oustanding amount due each year (in $).
Basically, I'm trying to sum all codes that start with the same two digits for each year. I'm able to sum columns individually as such:
However I want to sum all codes that start with the same two digits for each year. Remember each row is a year and the columns represent account numbers. I know there's something about left function too... but not sure here.
Sorry if this is a lot to ask!
Thanks.
Best
I'm new to this forum and relatively new to VBA. I'm currently working on a project and I'm trying to code the following, but I'm having difficulty.
My data is a static table. The first column it titled Year and goes from 2011 to 2015. The columns thereafter are titled with 6 digit codes which correspond to account numbers under which is an oustanding amount due each year (in $).
Basically, I'm trying to sum all codes that start with the same two digits for each year. I'm able to sum columns individually as such:
Code:
Sub sum_stuff()
Dim LR As Long
With Sheets("Static")
LR = .Range("D" & Rows.Count).End(xlUp).Row
.Range("D" & LR + 1).Value = WorksheetFunction.Sum(.Range("D1:D" & LR))
End With
End Sub
However I want to sum all codes that start with the same two digits for each year. Remember each row is a year and the columns represent account numbers. I know there's something about left function too... but not sure here.
Sorry if this is a lot to ask!
Thanks.
Best