Pop Up Message if specific cells are greater than other specific cells

tabs1063

New Member
Joined
Nov 30, 2015
Messages
4
Hello-I've created a vba macro to give a pop-up warning if an amount in one cell exceeds the amount in another cell. This macro works fine for this specific product analysis. However, I'd like to repeat this pop-up for other specific cells on the same sheet for other specific product analyses. I'm having trouble copying/adding the same pop-up to apply to the other cells further down. The goal is to add multiple types of investments and have a pop-up if the total of that investment exceeds the value limit. For example contributions, 401k employee contributions, Company 401k contributions to employees, Roth IRA, Traditional IRA, and more. In my spreadsheet, the macro I've created for the HSA investment gives the pop-up when the amount in D12 exceeds that in B14. But now I've created my second type (401k Employee) and would like the same pop-up if D33 exceeds B35. After that, the same pop-up to a 3rd investment type, then 4th, and so on and so on. Please help me easily add more pop-ups as I create more criteria! I've attached my spreadsheet in Google Drive.
link to spreadsheet
Secondly would eventually like to have the spreadsheet more dynamic by creating a data table that stores multiple years of data which I could interactively select a certain year and that year's data is dynamically shown on a dashboard. Which allows it to toggle back and forth selecting one year to another and pulling up that years data. I've started a tab labeled "Data" which would store the data. I've seen dynamic dashboards that have 3 sheets. One for Data, one for the calculations, and the third for the dashboard results. That's what I'd like to create. I'd like the dashboard to automatically add the next year once that data has been entered.

I hope my explanations make sense! Thanks in advance for any help!!!
PS-I had trouble with the XL2BB which is why I created a link to a shared google drive folder.
 

Attachments

  • mr excell.png
    mr excell.png
    102.6 KB · Views: 13

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Also-below is the VBA Code used to create my initial pop-up for the first investment type (HSA).

Private Sub Worksheet_Change(ByVal Target As Range)

If Range("D12").Value > Range("B14").Value Then
MsgBox ("EXCEEDS ANNUAL IRS LIMIT!")
Target.Value = ""
End If

End Sub
 
Upvote 0
Hi,
I suggest for you to make each cell in column D links with adjacent cell for column B to make easy the things.;)
if you insist for specific cells then do as you did in the macro for the others cells.
 
Last edited:
Upvote 0
Hi,
I suggest for you to make each cell in column D links with adjacent cell for column B to make easy the things.;)
if you insist for specific cells then do as you did in the macro for the others cells.
Thanks for the suggestion. I can't do that since the "annual limit", "target" and "actual" may not all be the same. The "annual limit" is going to be the annual laws per IRS, whereas the "target" may be less than the law limits, and the "actual" could be higher or lower than the "target", however, cannot ever exceed the "annual limit". What is the code for adding to what I've already added? The issue is that the code works for the first measurement metric "HSA" but now that I've added a second measurement metric " employee 401K" and will be adding more, is where I'm running into my problem. How can I add code that includes the same pop-up if D33 exceeds B 35? And then, another and another in further rows down as I add measurements, which will all be with data from columns D and B, but in different rows as I continue. ie. D"X" and B"X". Note-"X" row being the variable as I go... Does this help clarify?
 
Upvote 0
your way is difficult for me , buddy .
I'm not sure if you understand me
I mean if I write in D2 bigger value than B2 then will pops message and D3 bigger than B3....and so on
 
Upvote 0
your way is difficult for me , buddy .
I'm not sure if you understand me
I mean if I write in D2 bigger value than B2 then will pops message and D3 bigger than B3....and so on
can you give me an example of how to write that? Right now I've got the pop-up message for the "HSA" metric. But now once I've added a second metric "Employee 401K Contribution" I also want the same pop-up for that one if the "actual value" in that cell exceeds its limit. Then how I would continue to add on to the VBA as I also continued to add additional metrics that I also want pop-up for. The VBA code for my first metric, which is for an HSA is below. Now that I've added a 401k into the sheet I need to modify the vba to add that pop-up. Make sense?

Private Sub Worksheet_Change(ByVal Target As Range)

If Range("D12").Value > Range("B14").Value Then
MsgBox ("EXCEEDS ANNUAL IRS LIMIT!")
Target.Value = ""
End If

End Sub
 

Attachments

  • Daniel- metrics layout concept.png
    Daniel- metrics layout concept.png
    102.6 KB · Views: 11
Upvote 0

Forum statistics

Threads
1,224,885
Messages
6,181,588
Members
453,055
Latest member
cope7895

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