I’m currently having a data validation problem in Excel and may be the victim of “over-thinking” the problem.
My requirement is simple – I receive a large amount of xls files which all need to comply to an exact format.
For example, I need all of the files I receive to have have the following strings in cells A1 to A3: “FirstName”, “LastName”, “Email”. (Case matters).
In reality, there are a lot more headers than this and trawling through every file and ensuring that all of the headings exist and are spelt correctly/in the correct case is very tedious and time consuming. I believe that it would be possible to create a module or tool in Visual Basic which could check the format and then return either correct/false based on whether the file complies with the required format.
I have looked into regular expressions (but believe that this may be overkill as I only require EXACT matches) and have no experience in using VB. I have looked online for help – some of which has been useful, some of which has be way too advanced for the tool I need.
Any help is greatly appreciated.
Thanks.
Do the following if you are using Windows:
The script will then run through the folder and tell you which files are not conforming to your header requirements.
(you can also modify the code below to include more headers, it should be obvious from my comments below in the “Else If” part).
P.S. Thanks to Rob van der Woude for the bottom Function 🙂