code copying line above
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Code for copying line above

Code for copying line above

resolvedResolved · Low Priority · Version 2003

replyReply Thu 22 Jul 2010, 12:08Delegate Joanne said...

Joanne has attended:
Excel VBA Intro Intermediate course

Code for copying line above

How can I write a code that copies the line above into a blank row underneath where the line above has a load of formatting and formulae.

For upcoming training course dates see: Pricing & availability

replyReply Thu 22 Jul 2010, 18:10Trainer Anthony said...

RE: Code for copying line above

Hi Joanne, thanks for your query. The easiest way to write this is to record it! It depends a lot on what your're trying to do and the structure of your data, but try recording yourself simply copying the row, moving down a row and pasting. That will take everything with it.

Alternatively, you could do the same and get the code to OFFSET one row down when it performs the copy, and furthermore you could loop through each cell making the value, numberformat etc of the cell below the same as the source cell. VBA is a flexible tool and there are usually more than one way of achieving the same thing. I'd start with the macro recorder and tweak the code from there.

Hope this helps,

Anthony

Thu 29 Jul 2010: Automatically marked as resolved.

 

Please browse our web site to find out more about
excel classes and other Microsoft training courses.

Excel tip:

Adding Rows or Columns in an Excel 2010 Worksheet

If you want to add a row to an Excel spreadsheet, these are the simple steps you should take:

With your mouse, right click on the row header below where you want the new row to be added. Then, click Insert.

Follow exactly the same steps if you want to add a column to an Excel worksheet, right click on the column header, choose Insert and the new column will be inserted to the left of the selected column.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard