Error in macro.

M

Michel

I am sorry, i am very new to Excel programming.

I try to create a macro to copy a formula in a column where the number
of lines os not constant..
This macro will be used in many cases, so the range should not be
precised as a cell, but as activeCell.

The macro does the follwing :
1go the left column, same line,
2.go down to the last cell end of the column
3.go to the next right column
4.put 1 into it
5.go up the column where the first full cell is (it is where the
formula must be copied)
6.copy this formula from this very cell until the las cell of the
column.


I have a problem at 6.
Here is what i wrote :

Selection.Copy
Range("ActiveCell").Copy Destination = Range("ActiveCell.Offset(1,
0)")
Selection.End(xlDown).Select
ActiveSheet.Paste

I dont see the mistake.
Can some one point out where it is ?
Thanks a lot
Michel
 
M

Mark Graesser

Michel,
Instead of writing a macro you can do this with the Fill Handle. After your left column is full, enter your formula into the top cell in the right column. With the formula cell selected, double click the little black square in the lower right corner of the selected cell. This will automatically fill down to the last cell.

Good luck,
Mark Graesser
(e-mail address removed)

----- Michel wrote: -----

I am sorry, i am very new to Excel programming.

I try to create a macro to copy a formula in a column where the number
of lines os not constant..
This macro will be used in many cases, so the range should not be
precised as a cell, but as activeCell.

The macro does the follwing :
1go the left column, same line,
2.go down to the last cell end of the column
3.go to the next right column
4.put 1 into it
5.go up the column where the first full cell is (it is where the
formula must be copied)
6.copy this formula from this very cell until the las cell of the
column.


I have a problem at 6.
Here is what i wrote :

Selection.Copy
Range("ActiveCell").Copy Destination = Range("ActiveCell.Offset(1,
0)")
Selection.End(xlDown).Select
ActiveSheet.Paste

I dont see the mistake.
Can some one point out where it is ?
Thanks a lot
Michel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top