PDA

View Full Version : Solved: Dollar symbol in formula



kunguito
05-15-2008, 08:09 AM
How do i get rid of the dollar symbol that appears in the cell when the procedure is executed?


Dim RgFormula As Excel.Range
Dim ws As Excel.Workbook
RgFormula.Formula = "=SUM(" & ws.Range(ws.Cells(FirstRow, FirstCol), ws.Cells(LastRow, FirstCol)).Address & ")"

Oorang
05-15-2008, 08:22 AM
RgFormula.NumberFormat = "0.00"

kunguito
05-15-2008, 10:29 AM
Hi Aaron,

Long time no see, uh? My guardian angel.

Are you sure about that one? It sounds kind of strange to me.
I ment $ as in absolute reference as opposed to relative reference.

Afterwards I perform a Range.Autofill and as the formula in the cell I'm replicating contains $ symbol, all the cells on which the Autofill is applied contain the same value.

Thanks a lot!

Bob Phillips
05-15-2008, 11:05 AM
Dim RgFormula As Excel.Range
Dim ws As Excel.Workbook
RgFormula.Formula = "=SUM(" & ws.Range(ws.Cells(FirstRow, FirstCol), ws.Cells(LastRow, FirstCol)).Address(False,False) & ")"

Oorang
05-15-2008, 11:07 AM
lol Then that won't work:) I thought you meant to get rid of a displayed dollar sign. To get rid of the absolute references do this:
Dim RgFormula As Excel.Range
Dim ws As Excel.Workbook
RgFormula.Formula = "=SUM(" & ws.Range(ws.Cells(FirstRow, FirstCol), _
ws.Cells(LastRow, FirstCol)).Address(False, False) & ")"
Also shouldn't it be "Dim ws As Excel.Worksheet"? ;)

kunguito
05-15-2008, 12:33 PM
Thanks Aaron