sandramac
asked on
Command Button
I need to find a way to active a message box based on several variables
First is ActiveCell.Offset (0,-31) value is between 0255-0258 or 0555-0559 or 0855-0859, or 1155-1159 or 1455-1459 or 1755-1759, or 2055-2059, or 2355-2359. And if ActiveCell.Offset (0,-35) is blank. Then activate Message Box "Please enter the data"
First is ActiveCell.Offset (0,-31) value is between 0255-0258 or 0555-0559 or 0855-0859, or 1155-1159 or 1455-1459 or 1755-1759, or 2055-2059, or 2355-2359. And if ActiveCell.Offset (0,-35) is blank. Then activate Message Box "Please enter the data"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- points to aikimark
Please leave any comments here within the
next seven days.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- points to aikimark
Please leave any comments here within the
next seven days.
per recommendation
SpideyMod
Community Support Moderator @Experts Exchange
SpideyMod
Community Support Moderator @Experts Exchange
Better ask al these excel questions in the Office section but here we go
Sub CheckInput()
Rem declare variables
Dim intCheckVal As Integer
Dim i As Integer, j As Integer
Rem check if cell to check is numeric else leave sub
If Not IsNumeric(ActiveCell.Offse
intCheckVal = ActiveCell.Offset(0, -1)
Rem set start values
i = 255
j = 259
Rem loop till the highest range to check
While Not i > 2359
If Not (i < intCheckVal And intCheckVal < j) Then
i = i + 300
j = j + 300
Else
Rem exit because the value was found in one of the ranges
Exit Sub
End If
Wend
Rem show the box
MsgBox "Please enter the data"
End Sub
this proc assumes you're using integer values for the ranges
HTH:O)Bruintje