ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   values (https://www.excelbanter.com/excel-programming/356303-values.html)

dajaal

values
 
Hi
I want to set a cell as follows

if cell a1 =3 then cell b1 must return x
but i want to restrict cell a1 to be less than 10 as well. in other words
cella1 must be greater or equal to 3 but less than 10.

PLEAAASE Help.



Jörg

values
 
Hi,

please insert the followin code intoo you Worksheet
------------------------------
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Range("A1").Value < 3 Or Range("A1").Value 10 Then
MsgBox "only between 0 an 10"
Range("A1").Select
End If
End Sub
-------------------------------
now, if you enter a value 10 or <3 you get an messagebox
and the focus stays on A1 so that you have to change the value...

Best regards



"dajaal" schrieb im Newsbeitrag
...
Hi
I want to set a cell as follows

if cell a1 =3 then cell b1 must return x
but i want to restrict cell a1 to be less than 10 as well. in other words
cella1 must be greater or equal to 3 but less than 10.

PLEAAASE Help.





Tom Ogilvy

values
 
Look at Data=Validation.

If you select Whole Number or Decimal, you are offered a Between Option
where you can set the min and max values.

--
Regards,
Tom Ogilvy




"dajaal" wrote:

Hi
I want to set a cell as follows

if cell a1 =3 then cell b1 must return x
but i want to restrict cell a1 to be less than 10 as well. in other words
cella1 must be greater or equal to 3 but less than 10.

PLEAAASE Help.




All times are GMT +1. The time now is 07:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com