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

后端 未结 7 1561
孤独总比滥情好
孤独总比滥情好 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:07

    It seems to me that @Salam Morcos solution will not give a proper answer. If table starts from cell A2 statment [MyTable[FirstColumnName]].Column would give value of 2. Proper solution would be:

    MsgBox [MyTable].Cells(2, [MyTable].Column-[MyTable[MyColumn]].Column + 1)
    

提交回复
热议问题