Select the last cell in a column

zacheisjd

Board Regular
Joined
Oct 23, 2008
Messages
50
I am very new to VBA and have Microsoft Office Excel 2007 Power programming with VBA in which this website was listed as a good reference site. I am working on a spreadsheet where I want to select the last non-empty cell in a column and the column always has some cells that are empty, though it is NOT the last non-empty cell in the column. This spreadsheet is automatically generated and I want to change this particular column to all one format and all one number, 0042. This spreadsheet is then loaded into another system via tab-delimited txt file, so this number is meant to serve as an indicator. Sounds like I gave too much information, just wanted to be clear. Any help is appreciated. Thanks.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
You're responding to an old thread, but you shouldn't need two .End(xlUp)
 
Upvote 0
Yes sorry and I realized there was a page 2 after posting.

If you take a .End(xlUp) off, you would just get the cell above the last cell...and by having a second, you get to the cell Under the first empty cell (as long as the cell above the last cell is not empty else you would already be at target)
 
Upvote 0
What would be the code to select the cell which is just below the last used cell in a particular column?
 
Upvote 0
How about
VBA Code:
Range("A" & Rows.Count).End(xlUp).Offset(1).Select
 
Upvote 0
Thank you very much @Fluff. This worked like a charm. However, I got stuck in one similar problem as this one.

Lets say I have my main excel workbook that contains 2800 rows (filled with data). I copied some information or range of rows from another workbook and pasted it in my main excel workbook. The pasted range was upto 1500 rows only. Now how can I delete the range from one cell below the last pasted cell row (i.e 1501 in this case) to 2800 rows? Sometimes it might be 1400 rows or 1700 rows depending on situations so my main objective is to delete the rows from one cell below the last pasted range upto the end (i.e row number 2800)
 
Upvote 0
As this is a totally different you need to start a new thread. Thanks
 
Upvote 0

Forum statistics

Threads
1,215,460
Messages
6,124,949
Members
449,198
Latest member
MhammadishaqKhan

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