Search code examples
vbaexcelnamed-ranges

VBA Excel select a range of cells within a named range


I have a Named Range col_9395 it is an entire column. I want to set a range within this Named range. I want the range to start at row 3 to row 200 of same column. Whats the best way to do this?

Original working line without Named Range:

Set rngBlnk = Sheet108.Range("T3:T200").SpecialCells(xlCellTypeBlanks)

This is the code I tried with no luck:

Set rngBlnk = Range("col_9395)(3,1):Range("col_9395)(200,1).SpecialCells (xlCellTypeBlanks)

Solution

  • Might be wrong, but I find this the easiest one:

    Private Sub Test()
        Dim rngBlnk As Range
        Set rngBlnk = Range("col_9395").Rows("3:200").SpecialCells(xlCellTypeBlanks)
    End Sub