Move to the bottom of a range of data

Tarver

Board Regular
Joined
Nov 15, 2012
Messages
113
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I'm trying to use VBA (novice!) to update a range of data, and I need to find the end of that range and then paste in new data. I'm currently selecting cell A1, moving to the bottom of that range, then trying to move one more cell down to get out of the filled-in area. Here's my code:

Code:
Range("A1").Select
Range(ActiveCell, ActiveCell.End(xlDown)).Select
ActiveCell.Offset(1).Select

This selects the filled-in range, but then deselects the range and moves the cursor down to cell A2, so I'll end up pasting data on top of existing values.

I'm sure I'm doing it wrong, but I can't find a good way to identify the range of rows that are filled in so that I can select the first empty row.

Any help you can offer would be most appreciated!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try this

Code:
    Range("A" & Rows.Count).End(xlUp)(2).Select
 
Upvote 0
Exactly what I needed, thank you! I learned something new.
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,226,730
Messages
6,192,708
Members
453,748
Latest member
akhtarf3

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