Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simply copy selected cell down 1

Status
Not open for further replies.

sera

Technical User
Jun 29, 2000
360
US
I'm pretty new to VBA, sorry for noob question.

I want to copy a selected cell down X number rows. Just like clicking the corner and dragging it down X number cells. This is text cells.

my problem is finding the row col of the selected cell.


Sera
 
my problem is finding the row col of the selected cell
Something like ActiveCell.Row and ActiveCell.Column ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 


Might be something like...
Code:
  x=5
  with Activecell
    .copy range(.cells(1,1), .cells(x,1))
  end with


Skip,

[glasses] [red]Be Advised![/red] Coeds studying ancient Egyptian plumbing, might be known as...
Pharaoh Faucet Majors [tongue]
 
Thanks All!

My solution:
Code:
Sub copy_down()
    y = ActiveCell.Column
    x = ActiveCell.Row
    txt = ActiveCell.Value
 
    ' I need this to copy down 65 cells

    For i = 1 To 65
        Cells(x + i, y).Select
        Selection.Value = txt
    Next i

End Sub

Sera
 
guess i got my x y swapped! ugh! need more coffee

Sera
 


x=65

Skip,

[glasses] [red]Be Advised![/red] Coeds studying ancient Egyptian plumbing, might be known as...
Pharaoh Faucet Majors [tongue]
 
its not going from row 1-65
it could be going row 112-177 or row 388-453 etc.

Sera
 


did you TRY it???

Skip,

[glasses] [red]Be Advised![/red] Coeds studying ancient Egyptian plumbing, might be known as...
Pharaoh Faucet Majors [tongue]
 
No matter what row you are in try
activecell.offset(65,0)=activecell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top