Using formulas in VBA

K

Kevin

Hi i am having trouble putting this formula in my code any idea where i have gone wrong

Cells(intRowCount + 1, 4) = WorksheetFunction.Substitute(Substitute(A4, "Total Amount - ", ""), " USD [Mln]", "") *

Pls hel
 
F

Frank Kabel

Hi
try replacing
A4
with
Range("A4")

--
Regards
Frank Kabel
Frankfurt, Germany

Kevin said:
Hi i am having trouble putting this formula in my code any idea where i have gone wrong?

Cells(intRowCount + 1, 4) =
WorksheetFunction.Substitute(Substitute(A4, "Total Amount - ", ""), "
USD [Mln]", "") * 1
 
B

Bernie Deitrick

Kevin,

Cells(intRowCount + 1, 4).Value =
Application.WorksheetFunction.Substitute(Application.WorksheetFunction.Subst
itute(Range("A4").Value, "Total Amount - ", ""), " USD [Mln]", "") * 1

or you can use VBA's Replace function instead of the Substitute
worksheetfunction.

HTH,
Bernie
MS Excel MVP

Kevin said:
Hi i am having trouble putting this formula in my code any idea where i have gone wrong?

Cells(intRowCount + 1, 4) = WorksheetFunction.Substitute(Substitute(A4,
"Total Amount - ", ""), " USD [Mln]", "") * 1
 
Top