Solved

Select A2 to Last populated cell in column A using one line of code

Posted on 2014-10-12
4
352 Views
Last Modified: 2014-10-14
Hi,

Can't seem to find a "one line of code" solution to selecting A2 to last populated cell in Column A.

I thought this should work but it doesn't.

Range("A" & Range("A" & Rows.Count).End(xlUp).Row).Select

Thanks

swjtx99
0
Comment
Question by:swjtx99
  • 2
4 Comments
 
LVL 12

Assisted Solution

by:tel2
tel2 earned 200 total points
ID: 40376307
You were close, swjtx99.

I didn't know how to do what you wanted in 1 step, but with the code you supplied I was able to work it out.

    Range("A2", "A" & Range("A" & Rows.Count).End(xlUp).Row).Select

Let me know if you don't understand why the above works.

BTW, I don't think the topics Microsoft Visual Basic.Net or VB Script apply to this question.  It's VBA, but I don't know if there's a zone for that, so you maybe Microsoft Excel Spreadsheet Software is the only appropriate option.
0
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 300 total points
ID: 40376404
Hi,

Shorter

Range("A2", Range("A" & Rows.Count).End(xlUp)).Select

Regards
0
 

Author Closing Comment

by:swjtx99
ID: 40379693
Hi and Thanks,

Have to give the edge to Rgonzo1971.

Amazing how many hours of google searching didn't return this answer.

swjtx99
0
 
LVL 12

Expert Comment

by:tel2
ID: 40380881
Fair enuf, swjtx.

Yes, googling for something as specific as this can be a waste of time, sometimes.

Thanks for the points.
tel2
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now