Copy to last line (cel) of data

jaycee

Active Member
Joined
Jul 22, 2009
Messages
323
I am using Excel 2003.

I want to select and copy data using a macro but only want to select upto and including the last line of data,
could be one line could be 200 lines.

I am using the following at the moment.

Sub RangeSelect()
ActiveSheet.Range("a100:h100", ActiveSheet.Range("a100:h100").End(xlDown)).Select
Selection.Copy
End Sub

But this selects lines after the last line of data.

Any help would be great.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
What if you did it from the bottom and looked to select upwards.

HTML:
Sub Macro1()
'
' Macro1 Macro
'

'
    Range("A65000").Select
    Selection.End(xlUp).Select
    Range(Selection, Selection.End(xlUp)).Select
    Range(Selection, Selection.End(xlToRight)).Select
    Selection.Copy
End Sub
 
Upvote 0
Hi Trevor

Many thanks for the reply, but it appears that my original works, as long as I have something in column A, which is what it is based on anyway.

Thanks
Jaycee
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top