#1   Report Post  
Posted to microsoft.public.excel.misc
nc nc is offline
external usenet poster
 
Posts: 119
Default Copy & paste table

I have the following table,

I would like to paste the data on different worksheets based on department
using macros.

Example of data,

Department Product Colour Qty Amount
History Prod1 Red 20 100
Law Prod3 Blue 10 200
Lang Prod3 Red 20 300
Design Prod4 Blue 30 100


For example, paste to worksheet History, Law, Lang and Design, maybe
different columns (it is fine if hardcoded in the macro) for the each
departments. Plus I will also need to paste the to say worksheet History1
with different columns to the worksheet History, again maybe for more than
one department.

The most efficient codes will be appreciated.



  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 117
Default Copy & paste table

Hi,

Check out question #7 on this page from Ashish.
http://ashishmathur.com/knowledgebaseII.aspx
You can download a copy of the file he developed.
It does not use macros but will accomplish your goal.
Hope this helps.

Dave


"nc" wrote in message
...
I have the following table,

I would like to paste the data on different worksheets based on department
using macros.

Example of data,

Department Product Colour Qty Amount
History Prod1 Red 20 100
Law Prod3 Blue 10 200
Lang Prod3 Red 20 300
Design Prod4 Blue 30 100


For example, paste to worksheet History, Law, Lang and Design, maybe
different columns (it is fine if hardcoded in the macro) for the each
departments. Plus I will also need to paste the to say worksheet History1
with different columns to the worksheet History, again maybe for more than
one department.

The most efficient codes will be appreciated.





  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 117
Default Copy & paste table

See Ron's site for a macro solution.
http://www.rondebruin.nl/copy5.htm
http://www.rondebruin.nl/copy5_4.htm


"nc" wrote in message
...
I have the following table,

I would like to paste the data on different worksheets based on department
using macros.

Example of data,

Department Product Colour Qty Amount
History Prod1 Red 20 100
Law Prod3 Blue 10 200
Lang Prod3 Red 20 300
Design Prod4 Blue 30 100


For example, paste to worksheet History, Law, Lang and Design, maybe
different columns (it is fine if hardcoded in the macro) for the each
departments. Plus I will also need to paste the to say worksheet History1
with different columns to the worksheet History, again maybe for more than
one department.

The most efficient codes will be appreciated.





  #4   Report Post  
Posted to microsoft.public.excel.misc
nc nc is offline
external usenet poster
 
Posts: 119
Default Copy & paste table

Thanks. I saw these solution. I would like to know how to change the code
to chose the columns to copy & paste the releavant deaprtment to their
specific worksheet.

for example

Department:History column: Department, Product, Quantity
Department:Law column: Department, Colour, Amount
etc.


"Bassman62" wrote:

See Ron's site for a macro solution.
http://www.rondebruin.nl/copy5.htm
http://www.rondebruin.nl/copy5_4.htm


"nc" wrote in message
...
I have the following table,

I would like to paste the data on different worksheets based on department
using macros.

Example of data,

Department Product Colour Qty Amount
History Prod1 Red 20 100
Law Prod3 Blue 10 200
Lang Prod3 Red 20 300
Design Prod4 Blue 30 100


For example, paste to worksheet History, Law, Lang and Design, maybe
different columns (it is fine if hardcoded in the macro) for the each
departments. Plus I will also need to paste the to say worksheet History1
with different columns to the worksheet History, again maybe for more than
one department.

The most efficient codes will be appreciated.






  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 117
Default Copy & paste table

First note that "History" is reserved by Excel and can not be used as a
Sheet Name. If you want to use History as a department change it by adding
a -(dash) or something else.
Regarding changes to the macros:
All the macros that use the variable "My_Range" will need to be changed to
meet your needs. If your example starts in A11 then change the line
Set My_Range = Range("A11:D" & LastRow(ActiveSheet)) to
Set My_Range = Range("A11:E" & LastRow(ActiveSheet))
I would not try to change the code to copy specific columns for specific
departments.
Instead, set up each sheet with the proper Department Names and include All
the column headers beginning at A1. On each department sheet Hide the
columns you don't want to see.
Then use the Sub "Copy_To_Worksheets_2()"
The only other change required to the code will be to remove the line (or
mark as a comment by placing an ' apostrophy in front of)
".PasteSpecial Paste:=8"
This part of the code sets the column width of the destination range. With
it removed, your hidden columns will remain hidden.
These macros are advanced and call User Defined Functions. If you are new to
VBA, see these sites and others.
http://www.mvps.org/dmcritchie/excel/getstarted.htm
http://www.anthony-vba.kefra.com/vba/vbabasic1.htm

Best Wishes
Dave




"nc" wrote in message
...
Thanks. I saw these solution. I would like to know how to change the
code
to chose the columns to copy & paste the releavant deaprtment to their
specific worksheet.

for example

Department:History column: Department, Product, Quantity
Department:Law column: Department, Colour, Amount
etc.


"Bassman62" wrote:

See Ron's site for a macro solution.
http://www.rondebruin.nl/copy5.htm
http://www.rondebruin.nl/copy5_4.htm


"nc" wrote in message
...
I have the following table,

I would like to paste the data on different worksheets based on
department
using macros.

Example of data,

Department Product Colour Qty Amount
History Prod1 Red 20 100
Law Prod3 Blue 10 200
Lang Prod3 Red 20 300
Design Prod4 Blue 30 100


For example, paste to worksheet History, Law, Lang and Design, maybe
different columns (it is fine if hardcoded in the macro) for the each
departments. Plus I will also need to paste the to say worksheet
History1
with different columns to the worksheet History, again maybe for more
than
one department.

The most efficient codes will be appreciated.








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
how do I copy and paste table from netbank? kiregule Excel Discussion (Misc queries) 1 August 3rd 08 02:41 AM
Q: copy/paste table from Word JIM.H. Excel Discussion (Misc queries) 0 November 5th 05 04:57 PM
Copy & Paste table from Excel to Word Johnny37 New Users to Excel 1 October 10th 05 06:26 PM
Pivot table copy and paste yllee70 Excel Worksheet Functions 0 February 23rd 05 07:39 AM
copy/paste pivot table Todd L. Excel Worksheet Functions 0 December 30th 04 04:11 PM


All times are GMT +1. The time now is 12:59 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"