This is my macro so far. It copies and pastes the last used row under the last used row. I just want it to copy and paste A-I which messes up when I try to input it.
Please Login or Register to view this content.
Thanks
This is my macro so far. It copies and pastes the last used row under the last used row. I just want it to copy and paste A-I which messes up when I try to input it.
Please Login or Register to view this content.
Thanks
Last edited by alansidman; 11-02-2017 at 12:25 AM.
Hi paytoplay, welcome! This procedure finds the last used cell in column A, copies columns A:I of that row, and pastes them on the next row down.:Please Login or Register to view this content.
Last edited by leelnich; 11-01-2017 at 07:46 PM.
Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee
awesome, this worked great. Sorry but could you run through a little bit of what each code does so I know how to tackle it next time? I'm relatively new to VBA, but it's very fun and frustrating
'All defined cell ranges are assumed to be on the ACTIVE worksheet unlessPlease Login or Register to view this content.
'some other sheet is specified, so let's activate the one we're working on.
'Starting at the very bottom of column A, search up until you find a NON-BLANK cell.Please Login or Register to view this content.
'This is equivalent to selecting cell A10488576 and pressing CTRL + UP_ARROW.
'Once you've got the right single-cell range, expand it to include 1 row x 9 columns.
'The With statement lets us temporarily use methods and properties on a specified OBJECT
' - in this case our 9-cell range - without having to fully "qualify" it every time. Simply
'precede the method or property with a period ("."); VBA will know which object they apply to.
'We're applying the Range.Copy and Range.Offset methods to the last row of data. The Range.CopyPlease Login or Register to view this content.
'method has an option to do "simple" copy/pastes in one operation by specifying the destination.
'(If you need more control over the process, use a separate Range.PasteSpecial statement.) We
'want to paste in the next row down. The Range.Offset method is perfect for this; it let's us
'designate row- and column-offsets to define a new range of the same size as this one.
'We're done working with this object, so terminate the With "block". With statements can makePlease Login or Register to view this content.
'your code shorter AND faster, but tread carefully. A missing period is difficult to spot, but
'can cause your procedures to crash or behave strangely. Many a bug has been born thusly.
'Turn off the "Marching Ants" (animated copy border) and return to standard ready mode.Please Login or Register to view this content.
Please Login or Register to view this content.
@paytoplay
Code Tags Added
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.
Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.
Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html
(I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
Alan עַם יִשְׂרָאֵל חַי
Change an Ugly Report with Power Query
Database Normalization
Complete Guide to Power Query
Man's Mind Stretched to New Dimensions Never Returns to Its Original Form
@leelnich thank you so much. one day I will eventually be as good with VBA and teaching as you are
You're welcome, thank you for the rep! When it comes to coding, it's all about moving in a known direction through trial and error. Don't be afraid to fail, and don't hesitate to ask for help when you're truly stuck.
Last edited by leelnich; 11-02-2017 at 03:19 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks