+ Reply to Thread
Results 1 to 3 of 3

Search a group of excel files for info?

Hybrid View

  1. #1
    Registered User
    Join Date
    07-13-2010
    Location
    KY
    MS-Off Ver
    Excel 2003
    Posts
    4

    Question Search a group of excel files for info?

    I have around 160 excel files with between 20-60 thousand rows of data in each of them.

    What I am wanting to do is search all 160 files for a specific word...I really don't care where it is inside the file as long as I can get a total of how many times it shows up in each file.

    I really just need a total count of how many times the word shows up or an outputed list would be better.

    Any way this can be done?

    pmw
    Last edited by pimpmyworksheet; 07-16-2010 at 11:59 AM.

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Search a group of excel files for info?

    Supposing:
    - the 160 files are xls files in directory "C:\wordcount"
    - the word you are looking for doesn't appeat twice in a cell.

    Sub snb()
      On error resume next
      c05="Word to look for"
    
      c00 = "C:\wordcount\"
      c01 = Dir(c00 & "*.xls")
      Do Until c01 = ""
        With Workbooks.Add(c00 & c01)
          x = 0
          For Each Sh In .Sheets
            Sh.Cells.Replace c05, "=110/0"
            x = x + Sh.Cells.SpecialCells(xlCellTypeFormulas, xlErrors).Count
          Next
          .Close False
        End With
        c02 = c02 & vbCr & "in " & c01 & ":  wordfrequency =  " & x
        c01 = Dir
      Loop
      ThisWorkbook.Sheets(1).Cells(1, 1).Resize(UBound(Split(c02, vbCr))) = Application.Transpose(Split(Mid(c02, 2), vbCr))
    End Sub

  3. #3
    Registered User
    Join Date
    07-13-2010
    Location
    KY
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Search a group of excel files for info?

    Perfect Thank You Snb!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1