![]() |
msgbox if you input text instead of numbers
Hi,
Does any of you have a minute to share with how i can validate input of a range of a sheet and not allow other than numbers + a msgbox about that? I already use the excel GUI "Validation" functions for other reasons, so I need to have this in code in a worksheet_change event. /Thanks |
msgbox if you input text instead of numbers
You could try something like this:
Dim vntCol As Variant Dim vntRow As Variant Dim strX As String For Each vntRow In Selection.Rows For Each vntCol In Selection.Columns With ActiveSheet.Cells(vntRow.Row, vntCol.Column) strX = .Value If IsNumeric(strX) = False Then strX = "Row " & CStr(vntRow.Row) & _ ", Column " & CStr(vntCol.Column) & _ " is not numeric." MsgBox strX End If End With Next vntCol Next vntRow Regards, Wes |
All times are GMT +1. The time now is 01:54 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com