Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|