Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default macro for copy-pasting from different workbooks

Hi all,

I have to do the following manually everyday to do my daily report.

Copy data from certain columns in a set of data and paste it into a
different workbook, e.g. I want to select only those column with heading 'SR
Num' and 'Date'. However, 'SR Num' will not always be in a particular column
- it can be in 'A', 'B', wherever.

How do I write a macro where it will

- find the columns with headings I want to select,
- copy all the data (rows of data vary day to day) and
- paste it into a different workbook (location for pasting is constant,
however, the file where I'm getting the data from changes everyday)?

Thanks!

Binty




  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default macro for copy-pasting from different workbooks

With the active workbook being the file that you want to get the data from, you could use something
like

Intersect(Cells.Find("SR Num").EntireColumn, ActiveSheet.UsedRange).Copy _
ThisWorkbook.Worksheets("Paste Sheet").Range("A2")

Intersect(Cells.Find("Date").EntireColumn, ActiveSheet.UsedRange).Copy _
ThisWorkbook.Worksheets("Paste Sheet").Range("B2")

HTH,
Bernie
MS Excel MVP


"Binty" wrote in message
...
Hi all,

I have to do the following manually everyday to do my daily report.

Copy data from certain columns in a set of data and paste it into a
different workbook, e.g. I want to select only those column with heading 'SR
Num' and 'Date'. However, 'SR Num' will not always be in a particular column
- it can be in 'A', 'B', wherever.

How do I write a macro where it will

- find the columns with headings I want to select,
- copy all the data (rows of data vary day to day) and
- paste it into a different workbook (location for pasting is constant,
however, the file where I'm getting the data from changes everyday)?

Thanks!

Binty






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
Macro for copy pasting details from main sheet hipul Excel Discussion (Misc queries) 1 June 26th 07 08:59 AM
MACRO COPY/PASTING GILBERT Excel Discussion (Misc queries) 1 August 31st 06 04:55 AM
How do I copy a new module to 200 workbooks with a macro? Patrick Young Excel Worksheet Functions 1 September 3rd 05 04:35 PM
copy text between 2 open workbooks via macro bigdaddy3 Excel Worksheet Functions 2 August 18th 05 06:37 PM
Copying and Pasting between Workbooks NothingButRomance Excel Worksheet Functions 0 May 13th 05 09:54 PM


All times are GMT +1. The time now is 07:32 PM.

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"