Convert cell value to currency via code in Basic
Verfasst: Di 6. Apr 2021, 15:19
Hello, this code works just fine - I just need to convert my interger number to a currency, but I think it doesn't work like that:
My current Solution at the end of the code snippet is: dest.NumberFormat = "€#,##0.00"
My current Solution at the end of the code snippet is: dest.NumberFormat = "€#,##0.00"
Code: Alles auswählen
Dim objDatei as Object
Dim objBlaetter As Object
Dim objBlatt As Object
Dim inputC As Object
Dim dest As Object
objDatei = ThisComponent
objBlatt = objDatei.Sheets(0)
inputC = objBlatt.getCellByPosition(1, 6)
row = 3
column = 18
dest = objBlatt.getCellByPosition(row, column)
Do While dest.Value <> 0
column = column + 1
dest = objBlatt.getCellByPosition(row, column)
Loop
dest = objBlatt.getCellByPosition(row, column)
dest.NumberFormat = "€#,##0.00"
dest.Value = inputC.value
objBlatt.Columns(0).OptimalWidth = True