Solved

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

Posted on 2014-10-12
4
350 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 11

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 48

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 11

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
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.

744 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

11 Experts available now in Live!

Get 1:1 Help Now