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 » Copying data
Copying data
Resolved · High Priority · Version 2007
Lee has attended:
Excel VBA Intro Intermediate course
Copying data
What is the code for copying data from a cell down to the point where the data in the cell to the left stops.
I have data in cells C12 to C50 I need to write a code to copy the formula i have in cell D12 to D50
The number of rows that has the data will change every time i run the macro so i need to copy the data down as far as required.(i.e not down to row 50 every time)
Thanks
Lee
RE: Copying data
Hi Lee
Thanks for the question
I would create an uinteger variable and set it equal to the rows count of the current region of the first cell in the column.
introws = range("A1").currentregion.rows.count
you could then use a For loop to start at row one and go to the final row as determined above. At each point in the loop you could write in the formula
Regards
Stephen
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:Use shortcut keys to select rows or columnsMost users use the mouse to select rows or columns. It may be more convenient to use keyboard shortcuts to do that. |