Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default NaN Validation?

What's the best way to validate that something is not a number (or is a
number, for that matter) in excel VBA?
I need to handle an input box with this validation.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default NaN Validation?

forgot to mention - I used to do Javascript, and if you know Javascript, its
easy to do because there is the NaN function. But how to do it in excel VBA?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default NaN Validation?

You can use the IsNumeric function to return True or False
indicating whether a character string is numeric.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"MrPixie" wrote in message
...
What's the best way to validate that something is not a number

(or is a
number, for that matter) in excel VBA?
I need to handle an input box with this validation.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default NaN Validation?

MrPixie

Example

numbrows = InputBox("How many rows to insert")
If numbrows = "" Or Not IsNumeric(numbrows) Then
'do something

Gord Dibben Excel MVP

On Tue, 18 May 2004 18:14:20 +0100, "MrPixie" wrote:

What's the best way to validate that something is not a number (or is a
number, for that matter) in excel VBA?
I need to handle an input box with this validation.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default NaN Validation?

One more option is to use the application.inputbox.


Option Explicit
Sub test()
Dim myNumber As Variant
myNumber = Application.InputBox(prompt:="Number me!", Type:=1)
If myNumber = False Then
Exit Sub 'cancel
End If
'keep going
End Sub



MrPixie wrote:

What's the best way to validate that something is not a number (or is a
number, for that matter) in excel VBA?
I need to handle an input box with this validation.


--

Dave Peterson



Reply
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
Validation Data using Validation Table cell range..... Dermot Excel Discussion (Misc queries) 16 January 5th 10 09:35 PM
data validation invalid in dynamic validation list ilia Excel Discussion (Misc queries) 0 November 7th 06 12:54 PM
Validation (Drop down list vs simple text length validation) Bob Phillips[_6_] Excel Programming 2 April 27th 04 07:47 PM
Validation (Drop down list vs simple text length validation) Jason Morin[_2_] Excel Programming 1 April 27th 04 04:56 PM
Validation (Drop down list vs simple text length validation) Pete McCosh Excel Programming 0 April 27th 04 03:49 PM


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