View Single Post
  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

Maybe you could just change the format back to what you want after the change:

If that sounds ok, then rightclick on the worksheet tab that should have this
behavior. Select view code and paste this into the code window.

I used all of column A, but you could limit it to whatever range you want.

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim myRng As Range
Dim myFormat As String

myFormat = "_($* #,##0.00_);_($* (#,##0.00);_($* ""-""??_);_(@_)"

Set myRng = Nothing
On Error Resume Next
Set myRng = Intersect(Target, Me.Range("a:a"))
On Error GoTo 0

If myRng Is Nothing Then
Exit Sub
End If

myRng.NumberFormat = myFormat

End Sub


If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Deb22 wrote:

Can I protect a cell's numbering format so that the cell can be edited but
the $ cannot be changed?


--

Dave Peterson