How to remove currency format from Excel cell
I am trying to change an Excel file column format from to "Currency" to "Text" by using this VBA code, but it is not changing:
Private Sub Sample()
Dim ws As Worksheet
Dim LastRow As Long, Header As Long
Header = 2 '<~~ Start row for formatting
LastRow = 1000 '<~~ Last Row
Set ws = ThisWorkbook.Sheets("Sheet1")
With ws
With .Range("C" & Header & ":C" & LastRow)
'
'~~> Change format here
'
'~~> Number with 5 decimal places.
.NumberFormat = "@"
End With
End With
End Sub
I also tried on new empty (general) column which worked but not on C. Even when I try to insert a new column Excel automatically insert it with Currency format. Is there any other setting which may affect this?
How can I fix this?
Update
I also tried this code which didn't work:
Sub Clear_Cell_Backgroud()
Dim ws As Worksheet
ActiveSheet.UsedRange.Columns("C").NumberFormat = "General"
For Each ws In Worksheets
Cells.Interior.ColorIndex = xlNone
Next ws
End Sub