数据透视表值单元地址

是否有可能通过VB获取数据透视表中的值的单元格地址(或单元格范围)?

例:

Row Labels Count Threshold-% REG1 224 0.00% FALSE 11 TRUE 213 REG2 213 0.00% FALSE 13 TRUE 200 REG3 318 0.00% FALSE 3 TRUE 315 REG4 467 0.00% FALSE 7 TRUE 460 Grand Total 1222 0.00% 

我怎么能得到REG1 – > FALSE – > 11的单元格地址?

我知道当我点击它,它给了我“B3”,但我想通过VBfind它。

是的,你可以像这样得到你的数据。

https://msdn.microsoft.com/fr-fr/library/office/ff840045.aspx

https://msdn.microsoft.com/fr-fr/library/office/ff821539.aspx

之后你会发现它的地址是:

将单元格(1,1)转换为“A1”,反之亦然

或透视数据:

https://msdn.microsoft.com/fr-fr/library/office/ff195919.aspx

尝试这个:

 Sub test() Dim Data As Range, cl As Range Set Data = Range(Cells.Find("REG1").Offset(, 1), _ Cells.Find("REG2").Offset(-1, 2)) For Each cl In Data If UCase(cl.Value2) = "FALSE" And cl.Offset(, 1).Value2 = 11 Then Exit For Next cl If Not cl Is Nothing Then MsgBox cl.Address End Sub 

testing: 在这里输入图像说明