Link to home
Start Free TrialLog in
Avatar of JuJuChia
JuJuChia

asked on

Message Box keeps on popping up

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
Avatar of Dave
Dave
Flag of Australia image

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

There you go use this...

Saurabh..
OppLog.xlsm
Avatar of JuJuChia
JuJuChia

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Dave
Dave
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, Brettdj.