Hi friends,
I have this code (purpose of formula there is to extract some amounts from column B (highlighted by yellow in attached file) and put them in valid number format into column D (highlighted by green in attached file).
Problem is that code works perfectly for me on Excel 365, but if I send it to my colleagues which majority of them are on 2016 professional, it shows them Run-time error '1004': Application-defined or object-defined error.
Could you pls help me to fix it and if possible to make this code applicable for different versions of Excel?
Sub extract_amount()
Dim lw As Long
lw = Cells(14, 1).End(xlDown).Row 'range till blank row
'extract amount from column B
Range("D16").Formula = "=NPV(-0.9,IFERROR(--MID(B16,LEN(B16)-ROW(INDIRECT(""1:""&LEN(B16)))+1,1)/10,""""))/CHOOSE(ISNUMBER(FIND("" - "",B16))+1,100,-100)*-1"
Range("D16:D" & lw).FillDown
'formula above added "@" which I need to remove it in this next step to see valid result
Cells.Replace What:="@", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False, _
FormulaVersion:=xlReplaceFormula2
End Sub
Thank you in advance and have a great day
Bookmarks