I am trying to use an Excel macro to reformat a spreadsheet exported using OLE-Automation
The following code works fine:
Application.FindFormat.NumberFormat = "#,##0.0000000"
Application.ReplaceFormat.NumberFormat = "#,##0.00"
Cells.Replace What:="", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=True, ReplaceFormat:=True
if I changed ReplaceFormat to
Application.ReplaceFormat.NumberFormat = "#,##0.0"
to display only 1 decimal place, I get error 1004 (User Defined or Object Error). "0.0" also does not work.
I can set the cell format (Cells.NumberFormat) to "#, ## 0.0"
I only tried this against Excel-2003, as this is the only version I have.
source
share