Hello! First, let me thank you for looking at my thread in an effort to help me. I appreciate it!
I have a spreadsheet that looks similar to this spreadsheet.png but without the red values in column F. I want the macro to make the red totals (totals stay black, red is for clarification of what I want the macro to make.)
I need make a macro that will sum the figures in column E into column F based on if the word in Range("A2:A" & Lrow) is "MN" or "URS" or "Other"
I already have a function that calculates the last row of a transaction called Lrow. In this example, Lrow = 7
Sometimes, there may be no rows with MN in the A column. Sometimes there may be no rows with URS in the A column. Sometimes there may be no rows for "Others" in the A column.
Any help would be greatly appreciated!Dim groupMN as Integer
Dim groupURS as Integer
Dim groupOther as Integer
Dim lastMN as String
Dim lastURS as String
Dim lastOther as String
Dim rngA as Range
Set rngA = Range("A2:A" & Lrow)
For each Cell in rngAif Left(rngA, 2) = "MN" ThengroupMN = groupMN + ColumnE.Cell.Value _lastMN = ColumnE.Cell.AddressElseIf Left(rngA, 3) = "URS" ThengroupURS = groupURS + ColumnE.Cell.Value _lastURS = ColumnE.Cell.AddressElse groupOther = groupOther + ColumnE.Cell.Value _lastOther = ColumnE.Cell.AddressEndIfLoop
if groupMN > 0 Range(lastMN).Offset(0,1).Value = groupMN
if groupURS > 0 Range(lastURS).Offset(0,1).Value = groupURS
if groupOther > 0 Range(lastOther).Offset(0,1).Value = groupOther