Home » Questions » Computers [ Ask a new question ]

Select an entire column minus header row in an Excel macro

Select an entire column minus header row in an Excel macro

How would I access a range that corresponds to an entire column starting at row 2 (there is a header row)?

Asked by: Guest | Views: 315
Total answers/comments: 1
Guest [Entry]

"Referring to this SO answer, the only safe method is the .find() method.
All other methods may give wrong results if you previously deleted some cells.

Example to get the last cells

Lastrow = Cells.Find(""*"", [A1], , , xlByRows, xlPrevious).Row
Lastcol = Cells.Find(""*"", [A1], , , xlByColumns, xlPrevious).Column

And a specific answer to your question (assuming your data is in column 2, starting at row 2)

Range([B2], [B:B].Find(""*"", [B1], , , xlByRows, xlPrevious)).select"