additional pop up msgbox dependent on specific text entered into userform combobox, and other questions

Status
Not open for further replies.

Wishful Thinking

New Member
Joined
Dec 31, 2023
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Kudos to Skyybot for providing an answer to my previous question "pop up msgbox dependant on specific text entered into userform combobox" as shown below in red and here is a - Link to previous post with more info.

I have a few additional questions:

1: 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.

2: 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.

3: 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.

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


Thanks
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
1) All depends on how you want to interact. If not via sheet values, you could use an input box and a Select Case block. I'm not really following the logic for your posted code or why you'd put the Select Case block in the following position (it may not be in the right place) but maybe:
VBA Code:
Dim strFind As String, strMsg As String

strFind = Inputbox("Enter value to find")
If strFind <> "" Then
   If Not Range("B2:B1000").Find(What:=strFind,...) Is Nothing Then
       Select Case strFind
          Case "License"
             strMsg = "Two entries needed, one for tag payment and one for taxes."
          Case "dog"
             strMsg = "message for dog"
          Case "cat"
              strMsg = "message for cat"
       End Select
    End If
    msgbox strMsg
End If
You could add cases as you go, but repeatedly editing code to add tests might mean you should find a more efficient way, such as looping over a list of values - assuming you want to check several in the same operation. If not, a list of keywords and associated messages would avoid having to repeatedly add to code.

Please post code within code tags (vba button on posting toolbar) to maintain indentation and readability.
 
Upvote 0
Duplicate to: pop up msgbox dependent on specific text entered into userform combobox
In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread. If you do not receive a response, you can "bump" it by replying to it yourself, though we advise you to wait 24 hours before doing so, and not to bump a thread more than once a day.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,224,816
Messages
6,181,139
Members
453,021
Latest member
Justyna P

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