View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
jamescox[_9_] jamescox[_9_] is offline
external usenet poster
 
Posts: 1
Default Need help with format number


There may be better ways, and this requires you to add a code module and
a user-defined function to your workbook.

Add a code module (if you don't already have one) and put this code in
it:

Public Function HasEuro(rCell) As Boolean

Dim sAddress As String

sAddress = rCell.Address

If InStr(ActiveSheet.Range(sAddress).NumberFormat, ChrW(8364)) 0
Then
HasEuro = True
Else
HasEuro = False
End If

End Function



Use this cell formula, where B4 is the cell which may or may not have
the Euro sumbol in it:

=IF(HasEuro(B4),"",B4)

In the code above, the 8364 in ChrW(8364) is the Unicode value of the
Euro symbol for my English version of Excel - yours might be different
and you would need to find out what the value is and put it there. You
may be able to enter the following code in the Immediate Window of the
VBA IDE

?activesheet.range("d26").numberformat

where you replace d26 with some cell that does contain the euro, and it
will return something like

[$€-2] #,##0.00

then, type the line below in the Immediate window:

?ascw("")

copy the Euro symbol and paste it between the two "" (with no extra
blank spaces), then press Enter. For me, it gave

8364

Whatever number you get when you press Enter is the value you should
use in the HasEuro code - but if it's not a 4 digit number, something
has gone wrong.


--
jamescox
------------------------------------------------------------------------
jamescox's Profile: http://www.thecodecage.com/forumz/member.php?userid=449
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=111533