LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default msgbox for invalid data


Just use data validation like this:

Sub NumberVal()
Range("A1:D10").Select
With Selection.Validation
..Delete
..Add Type:=xlValidateWholeNumber, AlertStyle:=xlValidAlertStop,
_
Operator:=xlLessEqual, Formula1:="7"
..IgnoreBlank = True
..InCellDropdown = True
..InputTitle = ""
..ErrorTitle = "Invalid Data Entry"
..InputMessage = ""
..ErrorMessage = "You must enter a number either 7 or below!"
..ShowInput = True
..ShowError = True
End With
End Sub

Change the range to suit!

regards,
Simon


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=571414

 
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
Error Alert for Invalid Data doesn't work for data selected in col genegal Excel Worksheet Functions 0 January 25th 10 04:17 AM
Cleanout invalid data Mary Ann Excel Discussion (Misc queries) 4 February 12th 07 03:35 PM
How to create a MsgBox to alert user an invalid entry has been mad TimN Excel Programming 2 July 21st 06 02:45 PM
Data Validation: Printing Invalid Data Circles Andrew Excel Discussion (Misc queries) 1 May 4th 06 08:09 PM
MsgBox "Invalid property value" Excelente[_5_] Excel Programming 0 July 15th 05 01:16 AM


All times are GMT +1. The time now is 10:04 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"