Finding the last row or column containing data?

Joozh

Board Regular
Joined
Dec 30, 2002
Messages
114
Hi,

I have recorded a macro which copies a fixed range of cells and pastes the selection where the cursor is placed before running the macro. I always paste these cells 2 rows after the last row of my sheet. The problem with the macro is that if my cursor is placed anywhere but the desired location, it messes up my sheet :(

How can I modify my macro so that it always pastes the selection 2 rows after the last row containing data?

Also can I do something similar fo rcolumns? i.e how can I find the last column containing data?

Regards,

- J
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Joozh said:
Hi,

I have recorded a macro which copies a fixed range of cells and pastes the selection where the cursor is placed before running the macro. I always paste these cells 2 rows after the last row of my sheet. The problem with the macro is that if my cursor is placed anywhere but the desired location, it messes up my sheet :(

How can I modify my macro so that it always pastes the selection 2 rows after the last row containing data?

Also can I do something similar fo rcolumns? i.e how can I find the last column containing data?

Regards,

- J

For selecting the last row containing data in column A
Range("A65536").End(xlUp).Select

For selecting the last column containing data in row 1
Range("IV1").End(xlLeft).Select

GNaga
 
Upvote 0

Forum statistics

Threads
1,221,691
Messages
6,161,322
Members
451,696
Latest member
Senthil Murugan

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