VBA code which show a Pop Box in Excel if condition is meet.

Lucky Cool

New Member
Joined
Oct 22, 2019
Messages
3
Hello Friends

I am in little trouble hope you will help me.

I have a excel sheet and into this sheet data is fetch from another Software (Live Data).

Company NameValueReaching ValueStatus
A10002500Sell
B50002500
C40002500Buy
D45262500
E18792500
F40002500
G40002500

<colgroup><col><col span="2"><col></colgroup><tbody>
</tbody>

I Put Formula in Status Column Now I want If Column is blank so its ok But if Status Column Find Sell or Buy then it Pop up a Message Box "Please Review It" with Cell Name like D2 or D4 or if there is 5 sell or Buy then 5 popup box will Open automatically.

&

If i Closed the sheet and open sheet again and if again is there any sell or buy then show pop up again automatically....
I do not want any macro button because for this i have to always click button.

Hope you can understand my Query

Please help. Thanks in Advance.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Re: Need a [VBA] code which show a Pop Box in Excel if condition is meet.

Try this:
Put the code in the code module of the sheet in question:

Code:
[FONT=Lucida Console][COLOR=Royalblue]Private[/COLOR] [COLOR=Royalblue]Sub[/COLOR] Worksheet_Activate()
[COLOR=Royalblue]Dim[/COLOR] i [COLOR=Royalblue]As[/COLOR] [COLOR=Royalblue]Long[/COLOR]
[COLOR=Royalblue]Dim[/COLOR] va

va = Range([COLOR=Darkcyan]"D1"[/COLOR], Cells(Rows.Count, [COLOR=Darkcyan]"D"[/COLOR]).[COLOR=Royalblue]End[/COLOR](xlUp))

[COLOR=Royalblue]For[/COLOR] i = [COLOR=Brown]2[/COLOR] [COLOR=Royalblue]To[/COLOR] [COLOR=Royalblue]UBound[/COLOR](va, [COLOR=Brown]1[/COLOR])
    [COLOR=Royalblue]If[/COLOR] va(i, [COLOR=Brown]1[/COLOR]) = [COLOR=Darkcyan]"Buy"[/COLOR] [COLOR=Royalblue]Or[/COLOR] va(i, [COLOR=Brown]1[/COLOR]) = [COLOR=Darkcyan]"Sell"[/COLOR] [COLOR=Royalblue]Then[/COLOR] MsgBox [COLOR=Darkcyan]"Review this: D"[/COLOR] & i
[COLOR=Royalblue]Next[/COLOR]

[COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]Sub[/COLOR][/FONT]
 
Upvote 0
Re: Need a [VBA] code which show a Pop Box in Excel if condition is meet.

Sorry Friend But it is not Working :(
 
Upvote 0
Re: Need a [VBA] code which show a Pop Box in Excel if condition is meet.

Hi,

Live data might require you to test another event Worksheet_Calculate() ...

Hope this will help
 
Upvote 0
Re: Need a [VBA] code which show a Pop Box in Excel if condition is meet.

Can you explain in more detail "it is not Working"?
Private Sub Worksheet_Activate() is triggered when you open another sheet then go back to the sheet.
 
Upvote 0
Re: Need a [VBA] code which show a Pop Box in Excel if condition is meet.

Thank You so much James & Akuini. Now its Working, I have Changed
Worksheet_Activate() into Worksheet_Calculate(). :)

Again Thank You So Much..
 
Upvote 0
Re: Need a [VBA] code which show a Pop Box in Excel if condition is meet.

You are welcome :)
 
Upvote 0
Re: Need a [VBA] code which show a Pop Box in Excel if condition is meet.

You're welcome, glad to help, & thanks for the feedback.:)
 
Upvote 0

Forum statistics

Threads
1,213,533
Messages
6,114,179
Members
448,554
Latest member
Gleisner2

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