View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein \(MVP - VB\)[_995_] Rick Rothstein \(MVP - VB\)[_995_] is offline
external usenet poster
 
Posts: 1
Default Formula for multiple cells

I was thinking that code looked too short when I posted it.<g What happened
was I was getting ready to go to sleep for awhile and I wrote up the code
(with the On Error in it), tested it and then went to copy it into the
Clipboard to paste into a response to the OP... Excel crashed. Of course, my
code was not in the recovery worksheet; so I wrote it up again quickly
(remember, I was trying to go to sleep) and obviously forgot to include the
On Error statement. Thanks for catching my omission.

Rick


"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Rick

I think you forgot the On Error Goto Whoops

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
On Error Goto Whoops
Application.EnableEvents = False
Target.Value = 20 * Target.Value
End If
Whoops:
Application.EnableEvents = True
End Sub


Gord


On Sat, 26 Jul 2008 05:26:07 -0400, "Rick Rothstein \(MVP - VB\)"
wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
Application.EnableEvents = False
Target.Value = 20 * Target.Value
End If
Whoops:
Application.EnableEvents = True
End Sub