PC Review


Reply
Thread Tools Rate Thread

Copy Columns from multiple workbooks

 
 
Jen
Guest
Posts: n/a
 
      18th May 2009
Hi,

I need a macro to copy columns from multiple workbooks into one, but into
separate worksheets.

I have budget files which have headers like product name, department, ID,
and quaterly buget (Q1'10, Q2'10, Q3'10........Q4'15), but the header order
is different in each file and they contain addtional information.
I just want to extract columns what I need.

Another problem is range of quaterly budget is different from each files.
Some files has Q1'09, but some don't. I need to copy all columns starting
"Q".

How can I do all this thing?

Thank you in advance.
 
Reply With Quote
 
 
 
 
HelpExcel.com
Guest
Posts: n/a
 
      18th May 2009
Jen,

Sounds like there would be two parts to your program. The first would
identify the columns that need to be copied and the second part would
actually copy the columns.

If you are cycling through every worksheet in every open workbook, you can
use code similar to the following:

Public Sub test()

Dim bk As Workbook

For Each bk In Workbooks

For Each sht In bk.Sheets

Set rng = sht.Range("a1")

If Left(rng.Value, 1) = "Q" Then

'denote as column to be copied, or actually copy to
destination

End If

Next

Next

End Sub
--
Regards,
Eddie
http://www.HelpExcel.com


"Jen" wrote:

> Hi,
>
> I need a macro to copy columns from multiple workbooks into one, but into
> separate worksheets.
>
> I have budget files which have headers like product name, department, ID,
> and quaterly buget (Q1'10, Q2'10, Q3'10........Q4'15), but the header order
> is different in each file and they contain addtional information.
> I just want to extract columns what I need.
>
> Another problem is range of quaterly budget is different from each files.
> Some files has Q1'09, but some don't. I need to copy all columns starting
> "Q".
>
> How can I do all this thing?
>
> Thank you in advance.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy and paste selected columns between Excel workbooks Orimslala Microsoft Excel Programming 4 4th Apr 2008 10:21 AM
Copy certain columns matching column A in two workbooks =?Utf-8?B?Q2h1Y2thaw==?= Microsoft Excel Programming 3 14th Feb 2007 05:28 AM
I want to multiple workbooks that have the same columns =?Utf-8?B?S2h1cnVt?= Microsoft Excel Misc 5 23rd Sep 2006 10:18 PM
macro: copy multiple workbooks to multiple tabs in single book =?Utf-8?B?TWljaGFlbA==?= Microsoft Excel Programming 0 14th Jul 2006 04:53 PM
lookup a value from multiple columns of two workbooks =?Utf-8?B?QXNhZCAtIFNoYXJlZWY=?= Microsoft Excel Worksheet Functions 2 9th May 2006 11:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:59 AM.