I am looking for a robust way to return the formatted/shown value of a cell. First a simply used the Cell.Text
property but then I noticed a got errors when the cell was to small to fit. Then it only returns "########"
Here is a small example showing the problem. I want it to return 50.1000000 no matter how small the column is.
Sub Makro1()
' Desired action: Outputs text formatted value of activecell
'
MsgBox "The value is """ & ActiveCell.Text & """"
End Sub
I have tried using something like this (using Format
and the .Value
and .NumberFormat
properties) but I am unsure how robust it is. Is there a better way?
Sub Makro2()
' Desired action: Outputs text formatted value of activecell
'
MsgBox "The value is """ & Format(ActiveCell.Value, ActiveCell.NumberFormat) & """"
End Sub
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…