Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 542
Default modification to this code

I had some help with this code some months ago, and I could use a help
modifying it again.

Option Explicit

Sub GetReportsDataOnly()
Dim i As Long
Dim varr As Variant
Dim wkbk As Workbook
Dim sh As Object
Dim mybook As Workbook
Dim myExistingPath As String
Dim myPathToRetrieve As String

myExistingPath = CurDir
myPathToRetrieve = "X:\2502521400"
ChDrive myPathToRetrieve
ChDir myPathToRetrieve

varr = Application.GetOpenFilename(filefilter:="Excel Files, *.xls", _
MultiSelect:=True)

If IsArray(varr) Then
For i = LBound(varr) To UBound(varr)
Set wkbk = Workbooks.Open(varr(i))
With wkbk.Worksheets("INZONE")
On Error Resume Next
Set mybook = Workbooks.Open(.FoundFiles(i))
mybook.Close SaveChanges:=False
.UsedRange.Value = .UsedRange.Value
.Copy after:=ThisWorkbook.Worksheets _
(ThisWorkbook.Worksheets.Count)
End With
wkbk.Close SaveChanges:=False
Next
End If

'reset it back
ChDrive myExistingPath
ChDir myExistingPath

End Sub

The code goes and grabs any worksheet called "INZONE" from the
"X:\2502521400" folder , I still would like it to do this but I need it to
start at a parent directory called "X:\" and work its way through all the
folders at this level and pull anything called "INZONE".

In the workbooks that it is going through I do have sheets called "INZONE 1,
INZONE 2..." I would like for it to grabs those as well.

Thanks for the help


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
Code modification help AndyMP Excel Worksheet Functions 1 February 8th 09 11:41 PM
Macro Modification Help akemeny Excel Discussion (Misc queries) 1 December 3rd 08 06:11 PM
Modification Date ChrisAMEC Excel Discussion (Misc queries) 2 July 20th 07 06:36 PM
line code modification TUNGANA KURMA RAJU Excel Discussion (Misc queries) 3 March 2nd 07 01:12 PM
last modification Chip Smith Excel Discussion (Misc queries) 1 June 19th 06 11:55 PM


All times are GMT +1. The time now is 11:12 AM.

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"