ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   .Formula Property returning or setting inconsistent results? (https://www.excelbanter.com/excel-programming/375543-formula-property-returning-setting-inconsistent-results.html)

RjS, CISSP, CISA

.Formula Property returning or setting inconsistent results?
 
Hi All - I have two sections of code; one to handle credits, and therefore
the formula includes "+" signs, and the other to handle debits, and the
formula includes "-" signs. The code for the Credits works fine and returns a
proper formatted formula line in all cases (that begins with an "=" sign).
The code for Debits never includes the "=" sign at the beginning of any
return strings.

Can anyone spot why?

Credit Code:
wsDST.Cells(InFundFirstMtyRow, iColCnt).Formula = _
CStr(wsDST.Cells(InFundFirstMtyRow, iColCnt).Formula) & "+"
& _
CStr(wsSRC.Cells(iRowCnt, "E").Formula)
Above returns strings like "=4357.76+2345.65"

Debit Code:
wsDST.Cells(OutFundFirstMtyRow, iColCnt).Formula = _
CStr(wsDST.Cells(OutFundFirstMtyRow, iColCnt).Formula) & "-"
& _
CStr(wsSRC.Cells(iRowCnt, "D").Formula)
Above returns string like "4357.76-2345.65"

Thanks Much :)


All times are GMT +1. The time now is 12:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com