Solved

Command Button

Posted on 2002-03-29
4
145 Views
Last Modified: 2010-05-02
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"
0
Comment
Question by:sandramac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 6904736
Hi sandramac,

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.Offset(0, -1)) Then Exit Sub
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
0
 
LVL 45

Accepted Solution

by:
aikimark earned 23 total points
ID: 6905254
Select Case ActiveCell.Offset(0,-31).Value
  Case 0255 To 0258, 0555 To 0559, 0855 To 0859, 1155 To 1159, 1455 To 1459, 1755 To 1759, 2055 To 2059, 2355 To 2359
    If activecell.offset(0,-31).text = vbNullString Then
      Msgbox "Please enter the data"

End Select
0
 
LVL 16

Expert Comment

by:twalgrave
ID: 7754870
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.
0
 

Expert Comment

by:SpideyMod
ID: 7811796
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question