Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / December 2007

Tip: Looking for answers? Try searching our database.

Copying dada from multiple workbooks into 1 workbook

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jasonm - 16 Dec 2007 00:09 GMT
I tried searching here for an answer to this problem, but didn't find what
seemed like an appropriate solution... (Unless I am looking at it wrong...)
I have a folder with over 360 files I need to copy A to C and colums AE, AG,
AI and AK if data is present in these colums I would like to append that
data to another workbook in cells A - G (I think those column counts
match...)
I have tried several attempts at a macro to do this, but think VBA from the
file I am filling with data is my best bet. Is there an example of this out
there?
I will keep plugging away at this, and will post any resuts here to this
group.

Thanks for any help that you can offer! Jason
Jasonm - 16 Dec 2007 01:37 GMT
Sorry for the typo in the previous header! My fingers aren't nearly as fast
as my brain...

I have written the code to cycle through all of the files in the folder
(attached below) I think that I can copy the ranges that I want, but...
(there is always a but) I cannot find the last row of data (it will be
different in each workbook.

Jason

For intYear = 2006 To 2007

                                                 For intMonth = 1 To 12

                                                           For intDay = 1
To 31
                                                                     strFileName
= intYear & " " & Format(intMonth, "00") & " " & Format(intDay, "00") _
                                                                     & "
0000 (Wide).dbf"

                                                                     With
Application.FileSearch
                                                                           
   .LookIn = strDirectoryPointer
                                                                           
   .Filename = strFileName
                                                                     If
.Execute > 0 Then
                                                                     '
enter code here to copy and paste desired cells into working file
                                                                     '
This is Extra from cut and paste...
                                                                     MsgBox
"There were " & .FoundFiles.Count & _
                                                                     "
file(s) found."

                                                                     For i
= 1 To .FoundFiles.Count
                                                                     MsgBox
.FoundFiles(i)

                                                                     Next i
                                                                     Else
                                                                     MsgBox
"There were no files found."

                                                                     End If
                                                                     End
With
                                                           Next intDay

                                                 Next intMonth

                                       Next intYear

>I tried searching here for an answer to this problem, but didn't find what
>seemed like an appropriate solution... (Unless I am looking at it wrong...)
[quoted text clipped - 9 lines]
>
> Thanks for any help that you can offer! Jason
JLGWhiz - 16 Dec 2007 02:39 GMT
Ron Debruin has about every type of copy macro there is.  Check his site out:

http://www.rondebruin.nl/tips.htm

> I tried searching here for an answer to this problem, but didn't find what
> seemed like an appropriate solution... (Unless I am looking at it wrong...)
[quoted text clipped - 9 lines]
>
> Thanks for any help that you can offer! Jason
Jasonm - 16 Dec 2007 03:03 GMT
Thanks, I'll give him a look!

Jm

> Ron Debruin has about every type of copy macro there is.  Check his site
> out:
[quoted text clipped - 19 lines]
>>
>> Thanks for any help that you can offer! Jason
Jasonm - 16 Dec 2007 03:30 GMT
Thanks again, he did have just teh thing. Unfortunately I had too much data
to fit excel... I'll have to move to access.

Thanks again,

Jm

> Ron Debruin has about every type of copy macro there is.  Check his site
> out:
[quoted text clipped - 19 lines]
>>
>> Thanks for any help that you can offer! Jason
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.