Macro after loop code (1 Viewer)

F0ur2o

New member
Local time
Today, 12:02
Joined
Jun 3, 2008
Messages
4
Good afternoon all.

I am trying to run the 'loop through a folder' code on multiple workbooks I receive after seminars I hold.

The workbooks I receive are full of drop downs that have associated values of 1-3. (About 100 in total) This particular workbook has the drop downs on one worksheet and the numeric results on another worksheet 'Results'


The 'Totals' workbook (very basic) , just referenced each 'Results' worksheet and had equations that averaged all the drop downs cell by cell.

I would love to be able to use the 'loop through a folder' code to open them and then average them on the 'Totals' sheet.

I am a total VBA n00b. Any assistance would be appreciated.

If needed I can upload the code or sheet as an example.

Thanks in advance.

J


P.S. I know this is a common request it just didn't seem to fit my worksheet. Sorry for the redundancies.
 
Last edited:

F0ur2o

New member
Local time
Today, 12:02
Joined
Jun 3, 2008
Messages
4
Just in case.

The base folder would always be the same. ie c:\testresults\*.xls

The naming would be very similar.

Here is the thread where i found the first code I tried -- and failed.

http://www.ozgrid.com/forum/showthread.php?t=71552

And this loop code seemed more relevant as it did not seem to require any file naming and would run through a folder and process all XLS files.

http://www.ozgrid.com/VBA/loop-through.htm


anyone think these VB codes will work on my form.

I seem to get stuck here....obviously where I need to know more.

If .Execute > 0 Then 'Workbooks in folder
For lCount = 1 To .FoundFiles.Count 'Loop through all.
'Open Workbook x and Set a Workbook variable to it
Set wbResults = Workbooks.Open(Filename:=.FoundFiles(lCount), UpdateLinks:=0)

'DO YOUR CODE HERE

wbResults.Close SaveChanges:=True

Next lCount
End If
End With


Thanks again for any help.http://www.access-programmers.co.uk/forums/editpost.php?do=editpost&p=711267
 

Users who are viewing this thread

Top Bottom