'Formatting Numbers as Text Using VBA and Fixed Method
I have a column of numbers that need to be converted to text, with 2 decimal places. Excel has the FIXED function that does this directly within Excel. However, when I try to do it within VBA, it doesn't work. I don't get an error, but the numbers are not formatted correctly. Here is the macro that I have so far:
Sub FormatNumAsText()
Dim i As Integer
Dim NumComponents As Long
Dim RangeProp As Range
Dim strFixed As String
Set RangeProp = Range(Range("C1"), Range("C1").End(xlDown))
NumComponents = RangeProp.Rows.Count
For i = 2 To NumComponents
strFixed = WorksheetFunction.Fixed(Cells(i, 3), 2, True)
Cells(i, 3).Value = strFixed
Next i
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
