Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ignore text in macro/VBA

Status
Not open for further replies.

Batschin

Programmer
Mar 26, 2007
2
FI
I'm building an Excel model in which I would like to add a function in VBA that prevents a macro from being executed if the value in a cell is in text format. Let's say that the user should fill out a number in a cell, but by mistake fills in a word or just some letters. I would like this to make a messagebox appear that requests the user to check that cell. At the moment I have an IF-statement that prevents the macro if the value is zero, but I would need this addition to "stop" the model if a cell containes text... Could someone help me please? Thanx...
 
How are ya Batschin . . .

Have a look at the [blue]IsNumeric[/blue] function:
Code:
[blue]   If IsNumeric([purple][b][i]YourCellExpression[/i][/b][/purple]) Then
      [green]'Your code here[/green]
   Else
      [green]'Your message here[/green]
   End If[/blue]
BTW . . . this is the [blue]Microsoft: Access Forms[/blue] forum . . .

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top