Macro to copy cell data to word document based on an active row?
I have an Excel sheet that has several rows of data.
Is it possible for the user to highlight a cell in column A and then copy data from that row (specific cells) to a word document that has been previously created and contains bookmarks? Excel A B C D 1 J Smith 65 01/01/04 Mazada 6 2 S Jones 36 03/02/04 Mini 3 G Hall 25 06/06/04 Civic So the user will highlight one of the rows and then the macro will copy only the cells A, C, D and place them into the word document Word Dear, (name) Thank you for purchasing (car) on (date) any help would be greatly appreciated Brian |
Macro to copy cell data to word document based on an active row?
You may want to look into MailMerge (in MSWord).
These links may help: http://www.mvps.org/dmcritchie/excel/mailmerg.htm http://www.mvps.org/word/FAQs/MailMerge The first is from David McRitchie and the second is by Beth Melton and Dave Rado. IIRC, you could filter the database just for certain records. If worse comes to worse, you could add a new column and make it explicit (Yes/No) and filter by that when you're doing the mailmerge. Brian wrote: I have an Excel sheet that has several rows of data. Is it possible for the user to highlight a cell in column A and then copy data from that row (specific cells) to a word document that has been previously created and contains bookmarks? Excel A B C D 1 J Smith 65 01/01/04 Mazada 6 2 S Jones 36 03/02/04 Mini 3 G Hall 25 06/06/04 Civic So the user will highlight one of the rows and then the macro will copy only the cells A, C, D and place them into the word document Word Dear, (name) Thank you for purchasing (car) on (date) any help would be greatly appreciated Brian -- Dave Peterson |
Macro to copy cell data to word document based on an active ro
Thanks Dave for the links.
I was able to use some code from previous posts on this site, which appears to work using Bookmarks. I will also look at the mailmerge option with your tip of using a filter. Brian "Dave Peterson" wrote: You may want to look into MailMerge (in MSWord). These links may help: http://www.mvps.org/dmcritchie/excel/mailmerg.htm http://www.mvps.org/word/FAQs/MailMerge The first is from David McRitchie and the second is by Beth Melton and Dave Rado. IIRC, you could filter the database just for certain records. If worse comes to worse, you could add a new column and make it explicit (Yes/No) and filter by that when you're doing the mailmerge. Brian wrote: I have an Excel sheet that has several rows of data. Is it possible for the user to highlight a cell in column A and then copy data from that row (specific cells) to a word document that has been previously created and contains bookmarks? Excel A B C D 1 J Smith 65 01/01/04 Mazada 6 2 S Jones 36 03/02/04 Mini 3 G Hall 25 06/06/04 Civic So the user will highlight one of the rows and then the macro will copy only the cells A, C, D and place them into the word document Word Dear, (name) Thank you for purchasing (car) on (date) any help would be greatly appreciated Brian -- Dave Peterson |
All times are GMT +1. The time now is 11:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com