VBA Message Box Popup

AndyKim

New Member
Joined
Jun 24, 2009
Messages
30
Hello,

I would like some help in creating a VBA Macro that will create a popup message if cell C7 contains text. Cell C7 will populate text depending on a vlookup of a different sheet. The popup message is simple, something like "See Instructions".

Please advise on whether this is possible and what the best way to go about it is. Much thanks in advance.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
You can do this with a ws_change macro.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not IsNumeric(Range("C7")) Then _
        MsgBox "See Instructions", , "C7 - Alert"
End Sub

Put that into the sheet module where you want to watch C7.
 
Upvote 0
When do you want that message box to appear?

It sounds like you have two sheets, where C7 of Sheet1 contains a VLOOKUP of data in Sheet2 (are all of the arguments of the VLOOKUP on Sheet2 or is the first argument on Sheet1)

The User changes a value on Sheet 2 that results in Sheet1!C7 being text.
Do you want the box to appear at that moment?
or Do you want the box to appear when the user switches to Sheet1
or Do you want it to wait until the user selects Sheet1!C7?

Similar questions arise if the user changes a precddent cell on Sheet1.
 
Upvote 0
Thanks for the replies; appreciate it.

Cell C7 vlookups the value from C1. On the same sheet, a push of a button will change the value of C1 which pulls the data from a database.

When I push the button on Sheet 2, C1 will change as will C7. Sometimes C7 results in text, sometimes not depending on C1. If text appears, I would like the user to be alerted with a simple message popup.

Hopefully that makes more sense.
 
Upvote 0
This should do what you want when put in the sheet's code module.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    With Range("C7")
        If Not Application.Intersect(.Precedents, Target) Is Nothing Then
            If Application.IsText(.Value) Then MsgBox "See Instructions"
        End If
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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