Double Message box

Hi Experts,

I need Experts help. How to prevent message box from Sheet1 (Data) module which is ‘MsgBox: Search Data Not Found’ is not activated while processing “Sub ArchiveData_Send()” module. Currently 2 message boxes pop up after running “ArchiveData_Send()” procedure - by clicking copy button at Data sheet. Hope Experts will help me to fix this double message boxes. Attached the workbook.



Data-Update.xls
CartilloAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saqib Husain, SyedEngineerCommented:
Change the worksheet_change event to the following.

Saqib
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim bFound As Boolean

    '- Disable events: We're not interested in getting updates while we're changing things
    Application.EnableEvents = False
    
    If (Target.Address = "$C$2") Then
        '- Move back to the input box
        If (ActiveCell.Address <> Target.Address) Then Call Target.Select
        
        '- Clear the existing results
        '-   Our results start at row 4 and consist of 5 columns
        Range(Cells(4, 1), Cells(UsedRange.Rows.Count, 5)).Clear
        
        '- Load the master sheet
        Call LoadMasterDataSheet
        
        '- Disable screen updates/calculations (Speeds things up)
        Application.ScreenUpdating = False
        Application.Calculation = xlCalculationManual
        
        '- Do the search/copy results
        bFound = DoSearch(Target.Value)
        Call CloseMasterDataSheet
        
        '- Re-enable screen updates/calcuations
        Application.ScreenUpdating = True
        Application.Calculation = xlCalculationAutomatic
    
    '- Show not found dialog if we didn't find anything
    If (bFound = False) Then
        MsgBox "Search Data Not Found"
    End If
    End If
    
    '- Re-enable events
    Application.EnableEvents = True
    
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SmittyProCommented:
I suppose you could set a public Boolean variable (ArchiveMsg), then add a qualifier:

ArchiveMsg = False
    Call ArchiveData_Send
ArchiveMsg = True

Then in the Archive Data sub:

If ArchiveMsg = True Then MsgBox "Data has been updated."

You could also set it up with a text or numeric qualifier, or you could identify the button click with Application.Caller and turn it off that way.

HTH,
0
CartilloAuthor Commented:
Hi,

Thanks for the help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.