Solved

Command Button

Posted on 2002-03-29
4
140 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
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now