Solved

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

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
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.

777 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