Hi All,
reasonably new to VBA and need some help with my project.
I have a spread sheet that has customer abbreviation in Column "F" and a range of numbers "L:AA"
what I need is VBA code to find all occurrences for a each customer in column "F" and add each column individually and place total of each column in the corresponding cell on row 3.
"F" 5 (Row 3)
Customer 1 AB 1
AB 4
Customer 2 AC 6
AD 5
I have the below code with finds the customer "AB" and calculates the corresponding columns and places the total in row 3 but only works for the 1st column, not the complete row
Private Sub CommandButton1_Click()
Dim myval As Integer
Dim MyRange As Range
Dim MyRange2 As Range
Dim cell As Range
Set MyRange = Worksheets("Forecast").Range("F:F")
Set MyRange2 = Worksheets("Forecast").Range("L4:AA300")
myval = Application.WorksheetFunction.SumIf(MyRange, "AB", MyRange2)
Range("L3").Value = myval
End Sub
Can someone smarter than me please assist.
Thanks all.
reasonably new to VBA and need some help with my project.
I have a spread sheet that has customer abbreviation in Column "F" and a range of numbers "L:AA"
what I need is VBA code to find all occurrences for a each customer in column "F" and add each column individually and place total of each column in the corresponding cell on row 3.
"F" 5 (Row 3)
Customer 1 AB 1
AB 4
Customer 2 AC 6
AD 5
I have the below code with finds the customer "AB" and calculates the corresponding columns and places the total in row 3 but only works for the 1st column, not the complete row
Private Sub CommandButton1_Click()
Dim myval As Integer
Dim MyRange As Range
Dim MyRange2 As Range
Dim cell As Range
Set MyRange = Worksheets("Forecast").Range("F:F")
Set MyRange2 = Worksheets("Forecast").Range("L4:AA300")
myval = Application.WorksheetFunction.SumIf(MyRange, "AB", MyRange2)
Range("L3").Value = myval
End Sub
Can someone smarter than me please assist.
Thanks all.