View Full Version : eliminate part of formula via macro

06-17-2015, 06:29 AM
hey everone, in a certain cell, there's this formula: =sum(x1,x2,x3)+x4+x5

is there any way to make a macro get rid of anything AFTER the sum...ie x4 and x5?

Kenneth Hobs
06-17-2015, 09:39 AM
Sub ken() Range("A1").Formula = "=sum(x1,x2,x3)+x4+x5"
Range("A1").Formula = Split(Range("A1").Formula, ")")(0) & ")"
MsgBox Range("A1").Formula
End Sub