Solved

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

Posted on 2014-10-12
4
365 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 52

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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
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.

624 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