![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Location: NSW. Australia
Posts: 64
|
How would I seet up the following error checking code to also accept an empty field?
Private Sub txtPrice_Change() If IsNumeric(txtPrice) Then ' QTY Ok Else MsgBox ("Amount must be Numeric"), vbOKOnly, ("Text Entered") txtPrice = "0.00" End If End Sub Thanks in advance |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Hi Phil...
How do you want to process the empty field? Are you considering 00.00 to be empty? What's the problem? Tom |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Apr 2002
Location: NSW. Australia
Posts: 64
|
TsTom
What I need is to allow the user to enter a number or nothing at all into a text box. Currently with the code I have it will accept a number but nothing else. Thanks |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Well Phil,
I suppose this will do? Change: If IsNumeric(txtPrice) Then To: If IsNumeric(txtPrice) or Len(txtPrice) = 0 Then 'qty ok End If Tom |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Apr 2002
Location: NSW. Australia
Posts: 64
|
Thanks TsTom
That worked. Now how would I get the following to accept the # as well. If IsDate(txtDate) Or Len(txtDate) = 0 Then Thanks |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|