user3733731
user3733731

Reputation: 11

Selecting All Data In Column Containing Blanks

I want to select a range which takes in all data in a column (not including the header) that contains an unknown number of blank cells. I tried:

Columns("E:E").Select
Range(Selection, Selection.End(xlUp)).Offset(1).Select

However it doesn't seem to be working. Any Suggestions?

Upvotes: 0

Views: 1782

Answers (2)

Chris Harland
Chris Harland

Reputation: 476

Try this

Range("E2:E" & Cells.SpecialCells(xlCellTypeLastCell).Row).Select

You could, of course, add a variable in place of the E if you wish, but this will highlight from Row 2 down to as far as you have data entered.

Upvotes: 0

Gary's Student
Gary's Student

Reputation: 96753

Consider:

Sub dural()
    Dim cl As String
    cl = "E"
    N = Cells(Rows.Count, cl).End(xlUp).Row
    Range(cl & "2:" & cl & N).Select
End Sub

Upvotes: 1

Related Questions