Using formulas in VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top