Solved

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

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

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

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,…
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

751 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