I have the following code in a calc macro
Cell = Sheet.getCellByPosition(16,RowNo)
Cost = Cell.String
NewCost = Cost - 6
Cell = Sheet.getCellByPosition(16,RowNo)
Cell.String = NewCost
The result is a number expressed as a string, as expected, but I need a number to be able to carry out further calculations.
I have tried converting to a number using Cell.string = VAL(NewCost) and Cell.String = CSng(NewCost) but the result is still a string
Apparently I am doing something wrong but cannot find an answer after several searches.
Using Windows 10
[Solved] [Calc] Text to number
[Solved] [Calc] Text to number
Last edited by Hagar Delest on Thu Jun 11, 2020 8:27 am, edited 1 time in total.
Reason: tagged solved
Reason: tagged solved
OpenOffice 4.1.0 on windows 7
Re: text to number
If you want the cell value, use
Also, there is no needto do
Cell = Sheet.getCellByPosition(16,RowNo)
twice
Code: Select all
Cost = Cell.Value
Cell = Sheet.getCellByPosition(16,RowNo)
twice
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.