View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Auto number formatting

This seems to do the trick without select case.

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("H14")) Is Nothing Then Exit Sub
On Error GoTo endit
Application.EnableEvents = False
Me.Range("G20:G30").NumberFormat = "[$" & Target.Value & "] #,##0" & _
IIf(Target.Value = "INR", "", ".00")
endit:
Application.EnableEvents = True
End Sub

Thanks for the tip.


Gord

On Sat, 15 Sep 2007 12:07:54 -0400, "Rick Rothstein \(MVP - VB\)"
wrote:

Probably but OP wants no decimals if the choice is INR


Damn! I missed the "no decimals" part.


Of course, we can still save the one-liner replacement for your Select Case
block...

Me.Range("G20:G30").NumberFormat = "[$" & target.Value & "] #,##0" & _
IIf(target.Value = "INR", "", ".00")


Rick