98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Code for copying line above
Code for copying line above
Resolved · Low Priority · Version 2003
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.
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.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:The dual nature of toolbar buttonsMany toolbar buttons are dual purpose, though the two purposes are often linked in some way. For example, Align Left aligns a cell's contents to the left of the cell. However, hold down Shift and press the Align Left button: Excel aligns the cell contents to the right. |