pop up msgbox dependent on specific text entered into userform combobox

Wishful Thinking

New Member
Joined
Dec 31, 2023
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I added this to my worksheet (Sheet1 Checkbook Ledger) and it works if I'm inputting the text ("License") into the any cell in the "B" column.

Private Sub Worksheet_Change(ByVal Targe As Range)
If Not Range("B2:B1000").Find(What:="License", LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=True) Is Nothing Then
MsgBox "Two entries needed, one for tag payment and one for taxes."
End If
End Sub

I created a userform with comboboxes that list specific items (ie: "License") and again, the popup works. It also pop up on 5 of my other columns (C, D, E, and F) which is not what I want the pop up to do, I only want it to pop up when "License" is in any cell in column "B." It also pops up 7 times when using the userform before I can "X" it out and close it. That number is exactly the number of comboboxes and textboxes I have in the userform.

Here is a portion of my userform:

With cmbList_Transaction_Specific
.AddItem "Gas"
.AddItem "Transpo-Insur"
.AddItem "License"
.AddItem "Loan"
.AddItem "Transpo-Maint"
.AddItem "Transpo-Taxes"

So, I want any cell in column "B" that gets autofilled buy the userform with the text "LIcense" to give me only 1 pop up msgbox and not have to "X" it out 7 times before it closes or pop up on any other cell that is not in column "B".

Here's a pic of the actual spreadsheet columns.
1704059010504.png


Thank you for taking the time to review my question.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Try this
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Target.Column = 2 Then Exit Sub
If Not Range("B2:B1000").Find(What:="License", LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=True) Is Nothing Then
MsgBox "Two entries needed, one for tag payment and one for taxes."
End If
End Sub
 
Upvote 0
Solution
I found another entry for column 2 that I want to pop up a different msgbox. How would I go about adding other changes in the B2:B1000 range by keyword and popping up a different msgbox. I may find a few others so I'll want multiple changes if possible.
 
Upvote 0
Try this
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Target.Column = 2 Then Exit Sub
If Not Range("B2:B1000").Find(What:="License", LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=True) Is Nothing Then
MsgBox "Two entries needed, one for tag payment and one for taxes."
End If
End Sub
I found another entry for column 2 that I want to pop up a different msgbox. How would I go about adding other changes in the B2:B1000 range by keyword and popping up a different msgbox. This would include multiple keywords. I may find a few others so I'll want to create multiple changes based on multiple keywords if possible.

Also, how would I add to column 11 (M,N,O,P are merged cells that I use to reference what the payment was for). It would include multiple keywords (example: "Credit Card") and I don't want it to pop up a msgbox, I would rather it input into range M2:M1000 (I assume since it is the first cell of 4 merged cells) that would input something like "Gas", "Food", "House", etc.

And (yeah, getting greedy now), column 6 (my "Paid To") put in a fixed dollar amount into column 5 (my "Amount"). I have a few accounts (example: electricity is balanced budget and is the same cost per month) do I'd want the "Amount" column to reflect the fixed payment amount.

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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