Excel VBA Course

(35% Sale Ends Jan. 26)

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 (35% Discount)

Code won't work on all files


Hello. I will attach an excel file. I got the code from here and it's slightly modified. I only got one question. Why do I input a name to search, and it doesn't return all the results from all excel files? I mean, I have 6 excel files where I need to search it. 2 of them are in a format, the other 4 have another. In the first 2 it returns me the results, in the other 4 files it doesn't. Any ideas?



Selected Answer


It's difficult to say without seeing your files but please check these...

The code you're using assumes each of the searched files has values in columns 1 to 15 (A to O) with data from row 2 down PLUS  headings in row 1. The latter is where a match is made with your Field name (from dashboard cell F4). If those headings are absent or are different to your Field name e.g. have extra spaces (say at the end) then the field won't be found. 

Furthermore if the data in a correctly found column in the files doesn't match the searchValue (from dashboard cell F6), including capitalisation, then a match won't be found.

Hope this helps.


Answer the Question

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