user3917503
user3917503

Reputation: 11

Excel VBA - selecting the range from first row to the last row

I have a problem with VBA code. I have a sheet with a lot of data around the cells I want. I need to select data in column F, but the position of the first and last cells between the range is to be selected is changing up and down. I created the non empty cells in row X where there is no data do the LastRow function has any refernece but now I dont know how to select the first row

thx for help

Upvotes: 1

Views: 5750

Answers (1)

Erlesand
Erlesand

Reputation: 1535

If F1 is empty, this selects the first cell with data in the F column

Worksheets("Sheet1").Range("F1").End(xlDown).Select

If F1 may be non-empty you can add a check to see whether it contains text.

Upvotes: 1

Related Questions