copying data

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Copying data

Copying data

resolvedResolved · 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 courses

 

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Use shortcut keys to select rows or columns

Most users use the mouse to select rows or columns. It may be more convenient to use keyboard shortcuts to do that.

The shortcut key combination to select an entire row is Shift+Spacebar.

The shortcut key combination to select an entire column is Ctrl+Spacebar.

These are pretty easy to remember as the spacebar looks like a long row (or column if you're looking at it sideways). Remember that Ctrl, beginning with C, selects columns and Shift, by a process of elimination, the rows.

View all Excel hints and tips


Server loaded in 0.08 secs.