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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying a dynamic row

Status
Not open for further replies.

lpsmith

Technical User
Jul 8, 2004
4
US
Hi,

I would like to find out how to create a macro that will copy a set number of cells in a column no matter where the starting point is. For example I can copy 98 cells in column B starting at B2 or maybe starting at B34 or if I make G3 the active cell then when I run the Macro it will copy the next 98 cells below which ever cell I select.)

Thanks in advance for your help

L.Smith
 
Have you tried recording a macro, doing that?

Gerry
 
Yes but once I run the macro it hightlights the cells that I used when I recoreded the macro and not the active cell I'm in at the time.
 
Try this:

Sub Macro1()
Dim StartRow, EndRow, SelectionArea
StartRow = ActiveCell.Address
EndRow = ActiveCell.Offset(98, 0).Address
SelectionArea = StartRow & ":" & EndRow
Range(SelectionArea).Select
End Sub
 
That did it

Thanks so much for the quick response
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top