![]() |
Need simple 'Paste' macro code
I have a seemingly hard to find request....
I want to find or get guidance on code that will paste previously copied data to a specified cell (not a currently active. Essentially, I've create macros (and assigned a button form) in other active sheets of my document that copy the contents of a specified cell (eg - in the Data Worksheet, the Macro button copies the contents of cell B23.) I have 3 of these macros (with button form) in the Data Worksheet to copy; one button assigned to copy B10, another B23 and another B35. All copy flawlessly My intent is to paste the contents of whatever cell was copied from above Data Worksheet to a single/specified targeted cell in a Worksheet titled - Remarks. So, no matter which one of the above copy macros were used, I would like to paste that to cell A10 on the Remarks worksheet every time. I don't want the code to use whatever active cell the cursor is currently in (which is as far as I got on my macro code) but only to one specific cell predetermined by being nested in the code. Once the code is created, I will assign it to a button form. (current code...that doesn't do what I want....) Sub Macro2() ' ' Macro2 Macro ' Macro recorded 4/14/2007 by us ' ' Range("a1").Select ActiveSheet.Paste ' End Sub I've searched but only find quite complicated functions with multiple steps (copy/insert/paste) that I cannot extract good enough code to do my simple little deal. It's funny but I'm creating a sheet for my employees to use for consistent remarking and am using the macros and buttons to make them fool proof and thus why such simple stuff..... |
Need simple 'Paste' macro code
You don't need to do the select - paste method. PasteVar can be used later
to write to addtional cells. The Learn Macro always uses the Select method when just direct reads and writes of cells is better when manually writing code. Sub abc() ' Macro2 Macro ' Macro recorded 4/14/2007 by us ' PastVar = Sheets("sheet2").Range("a1") ActiveCell = PastVar ' End Sub " wrote: I have a seemingly hard to find request.... I want to find or get guidance on code that will paste previously copied data to a specified cell (not a currently active. Essentially, I've create macros (and assigned a button form) in other active sheets of my document that copy the contents of a specified cell (eg - in the Data Worksheet, the Macro button copies the contents of cell B23.) I have 3 of these macros (with button form) in the Data Worksheet to copy; one button assigned to copy B10, another B23 and another B35. All copy flawlessly My intent is to paste the contents of whatever cell was copied from above Data Worksheet to a single/specified targeted cell in a Worksheet titled - Remarks. So, no matter which one of the above copy macros were used, I would like to paste that to cell A10 on the Remarks worksheet every time. I don't want the code to use whatever active cell the cursor is currently in (which is as far as I got on my macro code) but only to one specific cell predetermined by being nested in the code. Once the code is created, I will assign it to a button form. (current code...that doesn't do what I want....) Sub Macro2() ' ' Macro2 Macro ' Macro recorded 4/14/2007 by us ' ' Range("a1").Select ActiveSheet.Paste ' End Sub I've searched but only find quite complicated functions with multiple steps (copy/insert/paste) that I cannot extract good enough code to do my simple little deal. It's funny but I'm creating a sheet for my employees to use for consistent remarking and am using the macros and buttons to make them fool proof and thus why such simple stuff..... |
All times are GMT +1. The time now is 08:36 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com