LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default VBA: Copy from columns on multiple worksheets

I have a template (Outlook Template) that gets updated by different division
in our company. My only issue with the Macro is that I may not have updates
for every division every time therefore certain sheets that I have set up in
the macro may not exist. This will cause my macro to error out & not sure
how to handle to make it flexible.

Also, is there an easier way that to repeat the code for each sheet as I am
copying the same columns from each worksheet? Only difference is that each
sheet name needs to populate column A on the Gross Sales In worksheet and the
data needs to be copied into the same columns one after the other.

Still very new at this so appreciate any help. Thanks.

Example:
'Copy RETAIL Outlook into Template
Windows("Outlook Template.xls").Activate
Sheets("RETAIL").Select
Range("H11").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("GROSS SALES IN").Select
Range("C4").Select
ActiveSheet.Paste

Sheets("RETAIL").Select
Range("C11").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("GROSS SALES IN").Select
Range("B4").Select
ActiveSheet.Paste

Range("B1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, -1).Select
ActiveCell.Formula = "RETAIL"
Selection.Copy
Range(Selection, Selection.End(xlUp).Offset(1, 0)).Select
ActiveSheet.Paste

'Copy MAIL-ORDER Outlook into Template
Sheets("MAIL-ORDER").Select
Range("H11").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("GROSS SALES IN").Select
Columns("C:C").Select
Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Select
ActiveSheet.Paste

Sheets("MAIL-ORDER").Select
Range("C11").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("GROSS SALES IN").Select
Columns("B:B").Select
Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Select
ActiveSheet.Paste

Range("B11").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, ActiveCell.Offset(0, -1)).Select
Range(Selection, Selection.End(xlUp)).Select
ActiveCell.Formula = "MAIL-ORDER"

Range("B1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, -1).Select
ActiveCell.Formula = "MAIL-ORDER"
Selection.Copy
Range(Selection, Selection.End(xlUp).Offset(1, 0)).Select
ActiveSheet.Paste

 
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
Need Simple List...Multiple Columns and Multiple Worksheets Jane Doe[_3_] Excel Worksheet Functions 6 July 14th 08 08:12 PM
linking multiple columns onto multiple worksheets talderman Excel Discussion (Misc queries) 3 August 23rd 06 02:00 AM
How do I copy columns between worksheets if the columns don't matc Miriam Excel Worksheet Functions 10 June 12th 06 04:29 PM
How do I automatically copy columns to/from Excel worksheets? Paul Excel Discussion (Misc queries) 2 December 28th 05 08:41 PM
Is there a way to copy multiple worksheets into one, row by row? Janet Excel Worksheet Functions 4 September 9th 05 06:37 PM


All times are GMT +1. The time now is 08:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"