Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Counting files using Loop

I am trying to count files and using a loop and some
variables to identify the server/directories/subdir.. etc

As it loops it keeps coming back with the quantity found
in the first loop gyration for all other loop gyrations.

The loop does seem to work because it stops in the right
spot, based on the DoUntil command, and places a file
count number (albeit of the first Loop) in the appropriate
cells, also part of the loop cammands.

Any suggestions?

Here's my cosde. This calls a FileSearch function called
CountAllFiles.

Sub TestCountFiles()

Dim i As Integer

i = 1

Do Until IsEmpty(Cells(i, 1))

'Change this to the directory you want to check.

Dim strMyDirectory As String

strMyDirectory = "C: /my documents/" & (Cells(i,
1))

' This holds the total number of files found.
Dim lFileTotal As Long

' Call the function. Pass the directory to check.

lFileTotal = CountAllFiles(strMyDirectory)

' Display the total files found in on spreadsheet
' in row i, Col H.
Cells(i, 8).Value = lFileTotal

i = i + 1

Loop

End Sub
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting Loop - Please help Zachary Baker Excel Discussion (Misc queries) 1 October 9th 08 04:57 AM
open files in loop with date order [email protected] Excel Discussion (Misc queries) 5 September 24th 07 01:10 AM
Counting files using Loop Ron[_13_] Excel Programming 0 October 28th 03 07:45 PM
Counting files using Loop Ron[_13_] Excel Programming 0 October 28th 03 07:45 PM
Loop thru files in DIR, delete worksheets & reset worksheet Name property?? Mike Taylor Excel Programming 1 October 24th 03 04:14 AM


All times are GMT +1. The time now is 03:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"