Hi;
I'm trying to create a macro to automatically sum columns G throughR, based on a condition of a value in column C.
If C = 'Total for Customer' (text statement)
Then AutoSum Columns G through R
I am linking cells in column C from another tab in the same workbook, so I have to have the macro pick up the values I'm calling, not the formula in Column C.
How do I modify this macro below to possible use for this purpose?
Sub testautosum()
'
' testautosum Macro
'
Range("C2").Select
Cells.Find(What:="Total for Customer", After:=ActiveCell, LookIn:= _
xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext _
, MatchCase:=False, SearchFormat:=False).Activate
Range("G15").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-3]C:R[-1]C)"
Range("G15").Select
Selection.AutoFill Destination:=Range("G15:R15"), Type:=xlFillDefault
Range("G15:R15").Select
End Sub
I'm trying to create a macro to automatically sum columns G throughR, based on a condition of a value in column C.
If C = 'Total for Customer' (text statement)
Then AutoSum Columns G through R
I am linking cells in column C from another tab in the same workbook, so I have to have the macro pick up the values I'm calling, not the formula in Column C.
How do I modify this macro below to possible use for this purpose?
Sub testautosum()
'
' testautosum Macro
'
Range("C2").Select
Cells.Find(What:="Total for Customer", After:=ActiveCell, LookIn:= _
xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext _
, MatchCase:=False, SearchFormat:=False).Activate
Range("G15").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-3]C:R[-1]C)"
Range("G15").Select
Selection.AutoFill Destination:=Range("G15:R15"), Type:=xlFillDefault
Range("G15:R15").Select
End Sub