Getting a value from a named range in VBA

前端 未结 2 1575
情深已故
情深已故 2021-01-13 05:32

I want to retrieve a value from named range. Imagine a named range that has X columns and Y rows. I want to return a value, e.g., from column 2, row 3. The issue I experienc

2条回答
  •  被撕碎了的回忆
    2021-01-13 06:00

    Use this

    ThisWorkbook.Names("myNamedRange").RefersToRange(1,1)
    

    To get the value from the first cell in the named range "myNamedRange"

    With ThisWorkbook.Names you can access all named ranges of all the sheets within the current workbook. With RefersToRange you get a reference to the actual range.

提交回复
热议问题