Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Help on vba

0

Hello. I've been trying to make myself a program to help me at work. I need a macro for searching in multiple excel files by a name that I input, and return me some of the values (not everything) from the other columns related to that name. I've created a form in excel, and I took the vba from this video: 

Fast Search Multiple Excel Workbooks using a File Picker Window - YouTube

Can someone help me adjust it? I really need it for my job and I can't figure it out. Also, when I click the search button, it only pops up the browse files window, and after it's closed, it erases everything outside the form.

Answer
Discuss

Discussion

Squishy

Please edit your question to:

1) add test files with the data you want to search

2) explain what is meant by "return me some of the values (not everything)" - I can't guess what you mean by that!
John_Ru (rep: 6102) Nov 17, '21 at 5:01 am
1) I have multiple excel files. Every file has a column for "Signal Name", and below it there are the names of some variables; and other columns that contain information about that variable: 
Signal Name | Color | Date | Time
Apple             | red    |  29   |  17:10
Peach            | yellow|  20  | 14:05
etc

2) for example, i want my form to return only the Color and Date, not all the columns in the excel.

I can't post my excels because there are confidential informations about my company. But I hope you understood what I need and you can help me!
Squishy (rep: 18) Nov 17, '21 at 6:15 am
Squishy

Thanks for the extra info but it's a bit confusing when you talk about returning Color and Date data but your sheet has entries for PDU Name etc.

Is Signal Name always the first column in your files and/or are column headers in a given row, say row 1? Are there variable numbers of columns? (This information needs to be provided in your question).

Also, we don't expect you to send confidential data but ask you to give representative files (with say 10-30 fake records). Furthermore you should never give us personal information which might breach data protection laws.
John_Ru (rep: 6102) Nov 17, '21 at 10:03 am
The Color and Date data were just as an example. Signal Name is a column header, mostly on U column, and it's stored data below, for each row.
I need to get a VBA for something like: input a given Signal Name, pick 1 or more excel files, and return only a few data (if the excel file has 10 columns, 1 is Signal Name, and I need it to return only the data of 3 more columns).
I will edit the question and add a representative file. Let's say I have multiple files in that format, and some have same names (but in each file different values), and I need to search for NAME 3, in 1 or multiple files, and return only the data in the DATA NAME fields, I don't need it to return the data in SOMETHING fields. (search NAME 2, list all name 2 results found in all files, list data from DATA NAME fields only.
Squishy (rep: 18) Nov 18, '21 at 2:04 am
Add to Discussion



Answer the Question

You must create an account to use the forum. Create an Account or Login