Tom Chambers
Tom Chambers

Reputation: 374

Excel Files and Visual Basic

I have never used Visual Basic before but could do with a pointer on where to begin.

I have 750 excel spreadsheets that contains various amounts of data of different types. The columns are always the same, but the number of data rows vary per spreadsheet. I need to extract data and put it into two new spreadsheets.

Obviously to do this 750 times manually would be a nightmare. I just want to run a script that can do it for me and thus thought of Visual Basic although i've never used it before.

My specific questions are:

  1. What type of command should i research that would allow me to copy data where the row number to start at varies (as data above varies in no of rows). There is a title before this new data - how can i get it to search for this title and then choose the row below?
  2. Would all my spreadsheets have to be in one folder so that the script goes through them all, or can i have some kind of folder structure in that folder too?
  3. Anyone recommend any good resources for me to get to grips with visual basic and grasp what i need to do?

thanks

Tom

Upvotes: 1

Views: 168

Answers (1)

iamstrained
iamstrained

Reputation: 164

So the compilation task got easier with the introduction of MS PowerQuery. If you are using MS Excel 2013, you already have this. If no, you should download it and use the extension from MS.

The following guide outlines how to Using Power Query to Combine Data from Multiple Excel Files into One Table. This means that with Power Query (PQ), MS has taken and enabled easy aggregation using a few simple button clicks. PQ is a lightweight alternative to a lot of tasks that used to require VBA.

In this example, you will use PQ to point to an entire folder (750 should be no problem) worth of commonly formatted Excel files. The only limitation is that each data file should have a similarly named tab.

I won't repeat the details of the guide for how to do it, as it is in-depth and visual. But if you run into issues, get in touch.

Upvotes: 2

Related Questions