Refer to Excel cell in Table by header name and row number

后端 未结 7 1557
孤独总比滥情好
孤独总比滥情好 2020-12-23 14:58

I\'m trying to refer to a cell in an excel table by using the table header name and the row number using VBA.

How can I do this?

7条回答
  •  甜味超标
    2020-12-23 15:20

    It is as simple as this. If you call by the name of the column, then the column index will be 1 for that range so:

    msgbox ActiveSheet.ListObjects(1).ListColumns("header4").DataBodyRange(2,1).value
    

提交回复
热议问题