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

I have a question concering checking a value of a number entered into a cell
I have a spreadsheet where a operator enters numerical values into cells
In cell B4, they enter a decimal value
Then the operator clicks on a Button which begins a macro that performs numerical calculations
I would like to know can I write into the macro to show an input box whenevery the numerical valu
of B4 exceed a value of 120
I would like to input box to give the operator a chance stop the macro and reenter the value in cell B
OR verify the number and continue with the macro
I am already using data validation into cell b4 to already ensure a decimal is entered without a describing label
I appreciate any help that someone can give
thanks mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default DataChecking

Mike,

The easiest way to do this would be to use Data | Validation.... Allow
Decimal, and set the limits to 0 to 120 or whatever is appropriate: that
way, the value is chaeck prior to starting the macro.

If you need to allow numbers greater than 120 sometimes (like an override)
then you could use code like:

Start:
If Range("B4").Value 120 Then
If MsgBox("Are your sure you want to use " _
& Range("B4").Value & _
" as the value for the macro?", vbYesNo) = vbNo Then
Range("B4").Value = Application.InputBox( _
"What value do you want to use?", , , , , , , 1)
GoTo Start:
End If
End If
'Other stuff here

HTH,
Bernie
MS Excel MVP

"Mike" wrote in message
...
I have a question concering checking a value of a number entered into a

cell.
I have a spreadsheet where a operator enters numerical values into cells.
In cell B4, they enter a decimal value.
Then the operator clicks on a Button which begins a macro that performs

numerical calculations.
I would like to know can I write into the macro to show an input box

whenevery the numerical value
of B4 exceed a value of 120.
I would like to input box to give the operator a chance stop the macro and

reenter the value in cell B4
OR verify the number and continue with the macro.
I am already using data validation into cell b4 to already ensure a

decimal is entered without a describing label.
I appreciate any help that someone can give.
thanks mike



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default DataChecking

Bernie
thanks

Mike

----- Bernie Deitrick wrote: -----

Mike,

The easiest way to do this would be to use Data | Validation.... Allow
Decimal, and set the limits to 0 to 120 or whatever is appropriate: that
way, the value is chaeck prior to starting the macro.

If you need to allow numbers greater than 120 sometimes (like an override)
then you could use code like:

Start:
If Range("B4").Value 120 Then
If MsgBox("Are your sure you want to use " _
& Range("B4").Value & _
" as the value for the macro?", vbYesNo) = vbNo Then
Range("B4").Value = Application.InputBox( _
"What value do you want to use?", , , , , , , 1)
GoTo Start:
End If
End If
'Other stuff here

HTH,
Bernie
MS Excel MVP

"Mike" wrote in message
...
I have a question concering checking a value of a number entered into a

cell.
I have a spreadsheet where a operator enters numerical values into cells.
In cell B4, they enter a decimal value.
Then the operator clicks on a Button which begins a macro that performs

numerical calculations.
I would like to know can I write into the macro to show an input box

whenevery the numerical value
of B4 exceed a value of 120.
I would like to input box to give the operator a chance stop the macro and

reenter the value in cell B4
OR verify the number and continue with the macro.
I am already using data validation into cell b4 to already ensure a

decimal is entered without a describing label.
I appreciate any help that someone can give.
thanks mike




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



All times are GMT +1. The time now is 10:19 PM.

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"