通过标题名称和行号引用表格中的Excel单元格 [英] Refer to Excel cell in Table by header name and row number
本文介绍了通过标题名称和行号引用表格中的Excel单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图通过使用VBA使用表标题名称和行号来引用excel表中的单元格.
I'm trying to refer to a cell in an excel table by using the table header name and the row number using VBA.
我该怎么做?
推荐答案
在您的示例中,如下所示:
In your example, something like this:
Dim tb As ListObject
'assumes Table is the first one on the ActiveSheet
Set tb = ActiveSheet.ListObjects(1)
MsgBox tb.DataBodyRange.Cells(2, tb.ListColumns("header4").Index)
这篇关于通过标题名称和行号引用表格中的Excel单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文