Unable to set a cell's format as currency

K

Kevlar

I have this code to set a cells format whenever data is entered from a
user form.

Private Sub TextBox5_Enter()
Range("R$25").Value = Round((Range("$m$25").Value +
(Range("$n$25").Value)) * (1 + Range("$q$25").Value))
TextBox5.Value = Round((Range("$m$25").Value +
(Range("$n$25").Value)) * (1 + Range("$q$25").Value))
Range("R$25").NumberFormat = "_($* #,##0.00_);_($* (#,##0.00);_($*
""-""??_);_(@_)"
End Sub

It works the first time I use it. The second and each subsequent time I
get a run time error '1004' Unable to set the number format property of
the range class.

Anyone got any ideas?

By the way I got the number format by using the record macro trick.
 
E

Earl Kiosterud

Kevlar,

I don't get the error. R25 displays a 0 as

$ -

with a couple of spaces after the dash.

I showed the userform twice consecutively. Still did OK. Excel 2002.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top