Thread: search facility
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
darren darren is offline
external usenet poster
 
Posts: 1
Default search facility

Hi Everyone.
Ive got some code below from some helpful chap on this
forum which i use to search through a whole range of
files in a folder, the problem is that it takes rather a
long time with it opening everysingle file.

Is there any way for it to do the same thing but with out
opening each file?

Simple instructions would be preferable, even better if
it can be a quick ammendment to the code below.

Thankyou for your help.


Set basebook = ThisWorkbook
rnum = 1
Do While FNames < ""
If Left(FNames, 1) = "0" Then
Set mybook = Workbooks.Open(FNames)
Range("A65000").End(xlUp).Select
n = ActiveCell.Row
Set sourceRange = mybook.Worksheets(1).Range
_ ("a1", "p" & n)
a = sourceRange.Rows.Count
Set destrange = basebook.Worksheets(1).Cells
_ (rnum, 1)
sourceRange.Copy destrange
rnum = rnum + a
mybook.Close False
End If
FNames = Dir()
Loop