I need a example vba code

kaksolver

New Member
Joined
Jul 4, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I am trying to create a VBA code that returns a message box with the multiple text that is found inside. I wanted to use a push button to initiate the search. I would also like to make this code available every time I open excel. Can anyone help?
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
What text do you need to be in side? What are you seeking in your excel file? Maybe if you can provide an example, this would help in solving.
 
Upvote 0
Example would be:

Column A
Contains the following Juice, Cheese, Pickles
Milk
Eggs
Bread
Water
Flour
Walnuts

I want the vba code to search all the text in column A and find 1st the word "Contains" then find Juice, Cheese, Pickles, Milk, Eggs
and return a message box that says "Contains Statement found - Contains" then find Juice, Cheese, Pickles, Milk, Eggs"
 
Upvote 0
If any of the words not found I need a message box to say "Contains statement incorrect - missing 1 or more ingredients"
 
Upvote 0
Hi. I am trying to understand your problem in the way you say, but, you need to upload your spreadsheet example. I re-write your question in order to work around your question but there are a little contradiction.
organizing your post you said:

1] returns a message box with the
multiple text that is found inside. ----------> ["multiple ?"] what really mean this.

2] use a push button to initiate the search.

3] available every time I open excel.

Column A

Contains the following Juice, Cheese, Pickles

Milk
Eggs
Bread
Water
Flour
Walnuts

4] in column A and find 1st the word "Contains"
5] then find Juice, Cheese, Pickles, Milk, Eggs -------->[ you mean juice is one thing with different ingredients, must be separate from, Pickles etc etc, confusing ]
6] return a message box that says

"Contains Statement found - Contains" then
find Juice, Cheese, Pickles, Milk, Eggs"

7] if any of the words not found then
message box to say:
"Contains statement incorrect –
missing 1 or more ingredients"

How do we know is missing something, how that happen, and when that happen. You really have different Cases here,
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,626
Members
449,093
Latest member
catterz66

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