[COLOR=darkblue]Sub[/COLOR] CountPopulatedCells()
[COLOR=darkblue]Dim[/COLOR] wb [COLOR=darkblue]As[/COLOR] Workbook
[COLOR=darkblue]Dim[/COLOR] rng [COLOR=darkblue]As[/COLOR] Range
[COLOR=darkblue]Dim[/COLOR] numCells [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR]
[COLOR=green]'set error trap for file doesn't exist[/COLOR]
[COLOR=darkblue]On[/COLOR] [COLOR=darkblue]Error[/COLOR] [COLOR=darkblue]Resume[/COLOR] [COLOR=darkblue]Next[/COLOR]
[COLOR=green]'loop through the file paths[/COLOR]
[COLOR=darkblue]Set[/COLOR] rng = Sheets("[COLOR=red]Sheet1[/COLOR]").Range("[COLOR=red]A1[/COLOR]")
[COLOR=darkblue]Do[/COLOR] [COLOR=darkblue]Until[/COLOR] rng = ""
[COLOR=green]'open the workbook[/COLOR]
[COLOR=green]'count the populated cells in sheet1[/COLOR]
[COLOR=darkblue]Set[/COLOR] wb = Workbooks.Open(rng.Value)
[COLOR=darkblue]With[/COLOR] wb.[COLOR=red]Worksheets(1)[/COLOR] [COLOR=green]'assumed first worksheet has to be processed[/COLOR]
numCells = Application.WorksheetFunction.CountA(.Range("[COLOR=red]A:A[/COLOR]"))
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]With[/COLOR]
wb.Close SaveChanges:=[COLOR=darkblue]False[/COLOR]
[COLOR=green]'output results to column B[/COLOR]
rng.Offset(, 1).Value = numCells
[COLOR=green]'get next file[/COLOR]
[COLOR=darkblue]Set[/COLOR] rng = rng.Offset(1, 0)
[COLOR=darkblue]Set[/COLOR] wb = [COLOR=darkblue]Nothing[/COLOR]
[COLOR=darkblue]Loop[/COLOR]
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Sub[/COLOR]