Solved

Message Box keeps on popping up

Posted on 2010-11-24
5
393 Views
Last Modified: 2012-06-21
Hello,  

I have included in my VBA a line that reads:  
MsgBox "Available from 1 to 150 MHz"
whenever there is an frequency entry (column M) in that is lower than 1 or higher than 150.  

However, the message box just keeps on popping up, even when the frequency section is empty.  You will see what I mean when you click on the drop down list in the attached file.  

I even added a case: Not IsEmpty (Cell M).  Please tell me how I can fix this bug.  

Thanks,
Juju
OppLog.xlsm
0
Comment
Question by:JuJuChia
[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
  • 2
  • 2
5 Comments
 
LVL 50

Expert Comment

by:Dave Brett
ID: 34210691
You could try this approach.

test it being between 1 and 150. if so do nothing

if not, test for blank
if blank do nothing
else delete (say for 200, or 0.5 etc)  and provide the message

Cheers

Dave
Case 1 < Range("M" & x).Value < 150
        Case Else
            If Not IsEmpty(Range("M" & x).Value) Then
                Range("M" & x).Value = ""
                MsgBox "Available from 1 to 150 MHz"
            End If
            'Limited frequency range for P4 (1 to 150 MHz)
        End Select

Open in new window

0
 
LVL 59

Expert Comment

by:Saurabh Singh Teotia
ID: 34210707
There you go use this...

Saurabh..
OppLog.xlsm
0
 

Author Comment

by:JuJuChia
ID: 34210856
Hi Brettdj and Saurabh,

I have tried following your approach, but when testing (type in 100), the message box came up.  Did I misunderstand your code?  


Thanks,
Juju
OppLog.xlsm
0
 
LVL 50

Accepted Solution

by:
Dave Brett earned 500 total points
ID: 34211002
Not my best day

pls try amended version
Select Case Range("M" & x).Value
        Case 1 To 150
        Case Else
            If Not IsEmpty(Range("M" & x).Value) Then
                Range("M" & x).Value = ""
                MsgBox "Available from 1 to 150 MHz"
            End If
    End Select

Open in new window

0
 

Author Closing Comment

by:JuJuChia
ID: 34211119
Thanks, Brettdj.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

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