LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Error handler question in Worksheet_Change event

Thanks RedarEye. It works great!
I've also made the following change - because the input cell is a merged
cell (i.e. N13:O13), but Excel doesn't seem to allow ClearContents in a
merged cell when a cell (i.e. O13) is empty.

change:
Tartget.ClearContents

to:
ThisWorkbook.Worksheets("Sheet1").Range("N13").Cle arContents


"Target.ClearContents"

"RadarEye" wrote:

Hi Sam,

Try this:

' Begin of code ------------------
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$N$13" Then
If Not IsEmpty(Target) Then
If IsNumeric(Target.Value) Then
If Target.Value < 50 Or Target.Value 130 Then
MsgBox "Please enter a value between 50mm and
130mm.", vbOKOnly + vbInformation
Target.ClearContents
End If
Else
MsgBox "Please enter a value between 50mm and 130mm.",
vbOKOnly + vbInformation
Target.ClearContents
End If
End If
End If
End Sub
' End of code ------------------------

HTH,

Execurot

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet_change event handler error gen Excel Discussion (Misc queries) 0 January 18th 08 04:55 AM
Error Handler Question Jenny B. Excel Discussion (Misc queries) 4 January 9th 08 05:16 PM
Run-time error '424' in VBA event handler on XL shutdown Mike Jones Excel Programming 3 May 6th 05 07:26 PM
Error with Target.Name.Name in Worksheet_Change event SuperJas Excel Programming 2 January 8th 04 03:26 AM
Worksheet_Change event question marwan hefnawy Excel Programming 1 September 10th 03 08:53 PM


All times are GMT +1. The time now is 11:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"