message alert box problem

ste33uka

Active Member
Joined
Jan 31, 2020
Messages
471
Office Version
  1. 365
Platform
  1. Windows
Hi i use the following code for message alert box,
Problem is the MsgBox does not show when my mouse on other monitor, ( duel monitor setup), Excel doesn't give the focus to the MsgBox.
The Excel icon will blink in the taskbar and if we click it, Excel shows message bsgbox.
Would there be anyway to fix this?

VBA Code:
Private Sub Worksheet_Alert()
Dim Msg As Long
    Dim myRange As Range
    Set myRange = Sheet85.Range("BD1:BD99")
    Dim cell As Range
    For Each cell In myRange
        Evaluate (cell)
        If StrComp(cell, "Yes", vbTextCompare) = 0 Then
        Cells(cell.Row, "BA") = 99999
            Msg = MsgBox("" & vbCrLf & " " & Range("BI" & cell.Row).Value & vbCrLf & Range("BP" & cell.Row).Value & vbCrLf & Range("BQ" & cell.Row) & Range("BR" & cell.Row).Value, vbExclamation)
            
        End If
    Next
        Set myRange = Sheet85.Range("BE1:BE99")
 
    For Each cell In myRange
        Evaluate (cell)
        If StrComp(cell, "Yes", vbTextCompare) = 0 Then
        Cells(cell.Row, "BC") = 99999
            Msg = MsgBox("" & vbCrLf & " " & Range("BJ" & cell.Row).Value & vbCrLf & Range("BP" & cell.Row).Value & vbCrLf & Range("BQ" & cell.Row) & Range("BR" & cell.Row).Value, vbExclamation)
            
        End If
    Next
        
    End Sub
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Problem solved i added AppActivate Application.Caption
to line before Msg = MsgBox
 
Upvote 0
Solution

Forum statistics

Threads
1,214,432
Messages
6,119,468
Members
448,900
Latest member
Fairooza

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top