Copy certain Excel cells to new sheet

Closed
E - May 27, 2010 at 11:26 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - May 28, 2010 at 05:23 PM
Hello,

I have data that is inserted in a row. I'm trying to create a macro that will copy certain cells within that row and paste them into cells in a different worksheet. The macro will be assigned to a text box at the end of each row, so in clicking that text box, the user is prompted for the file name and then the macro copies and pastes the data in the appropriate cells in the new sheet. How do I get the macro to reference only the row I'm currently inputting data into? Here's a snippet; I believe the rest of the code I'm using works since I copied it from another macro similar to this (but used in a different manner).

invoiceWS.Range(invoiceInvoiceCell) = srcWS.Range(srcInvoiceCol & ???)
invoiceWS.Range(invoiceDateCell) = srcWS.Range(srcDateCol & ???)
invoiceWS.Range(invoiceLastNameCell) = srcWS.Range(srcLNameCol & ???)



4 responses

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
May 27, 2010 at 04:44 PM
Could you please upload a sample file with sample data etc on some shared site like https://authentification.site , http://wikisend.com/ , http://www.editgrid.com etc and post back here the link to allow better understanding of how it is now and how you foresee.
0
have a button on each row to activate the macro that will copy that row
0
Columns A, B, C, D, E, F, G, H, I, J, K, L, M will have data as it's entered into that row. Columns A, B, C, D, G, contain data that I need to copy and paste to a different spreadsheet, in different locations (meaning A1 of source is F13 of destination). I can create a button to place at the end of the row and create a macro but I haven't been able to get it to replicate properly when the button and macro are copied to each row. If data starts on row 3, for example, and I create the first button there, it copies row 3. Copy the button and macro to row 4, it tries to copy row 3 again.

LAST FIRST EMAIL PHONE COUNTRY STATE CITY.....
Doe John j@d.c 111-111-1111 US GA Atlanta
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
May 28, 2010 at 05:23 PM
That is the reason that I was saying if you can upload a sample file with sample data and MACRO, it is easier to see what is the issue.
0