Error with Application.ReplaceFormat.NumberFormat

  • Thread starter Thread starter Handler Robert
  • Start date Start date
H

Handler Robert

Hello,

I want to replace a numberformat in a sheet from "0.00" to "0.000". But
i always get Error 1004 with following line in vba:
Application.ReplaceFormat.NumberFormat="0.000"

This can easily reproduced on running above line on a new sheet.

The crazy thing is, if i manually format a cell with numberformat
0.000, then i can run above line without errors.

Does anybody know a reason? Or how i can set the replaceformat to what
i want?

wkr
Robert
 
Hi Robert
replaceformat requires setting a format which should be replaced with
this new format. I'm not sure what you're trying to achieve but you may
try the following:
- the Excel help has quite a long example for ReplaceFormat
- record your macro while replacing a numberformat with this new
format. This should give you an indication how to do this
 
Back
Top