How to make command button doing 2 different orders

EzzatHesham

New Member
Joined
Jun 10, 2022
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
Hello everyone,
I made a userform for displaying data and i have 2 search levels by name and id and i made a 2 command buttons one for each search level. My question:
Is there any way to search with 2 levels by the same command button.
Thanks for helping ☺️💜
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Only if there is a way to "tell" the click event code which search level is desired. No idea where that info is on your form or even if it is there at all. So 3 possibilities (at least):
- you could read values if you have textboxes and code to act accordingly.
- a combo box might be better than buttons as you could use the afterUpdate event to do one thing or another, based on the choice made.
- if you don't want code to fire just because someone picks from the combo list, then perhaps use the combo and let the button click be the trigger.
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,490
Members
448,967
Latest member
visheshkotha

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