Private Sub CommandButton1_Click()
Dim rTable As Range
Dim lRow As Long
Set rTable = Sheets("Revenue Dashboard").PivotTables("PivotTable6").TableRange1
With Sheets("Overall Dashboard")
lRow = Application.Max(.Cells(.Rows.Count, "T").End(xlUp).Row + 1, 63)
.Range("T" & lRow).Value = rTable.Cells(rTable.Cells.Count).Value
.Select
End With
End Sub
Private Sub CommandButton2_Click()
Dim rngInput As Range
Set rngInput = Sheet1.Range("R63:T69") '
rngInput.ClearContents
End Sub
Private Sub CommandButton3_Click()
Dim rTable As Range
Dim lRow As Long
Set rTable = Sheets("Impression Dashboard").PivotTables("PivotTable5").TableRange1
With Sheets("Overall Dashboard")
lRow = Application.Max(.Cells(.Rows.Count, "T").End(xlUp).Row + 1, 127)
.Range("T" & lRow).Value = rTable.Cells(rTable.Cells.Count).Value
.Select
End With
End Sub
Private Sub CommandButton4_Click()
Dim rngInput As Range
Set rngInput = Sheet1.Range("R127:T137") '
rngInput.ClearContents
End Sub
Private Sub CommandButton5_Click()
Dim rTable As Range
Dim lRow As Long
Set rTable = Sheets("Clicks Dashboard").PivotTables("PivotTable8").TableRange1
With Sheets("Overall Dashboard")
lRow = Application.Max(.Cells(.Rows.Count, "S").End(xlUp).Row + 1, 197)
.Range("S" & lRow).Value = rTable.Cells(rTable.Cells.Count).Value
.Select
End With
End Sub
Private Sub CommandButton6_Click()
Dim rngInput As Range
Set rngInput = Sheet1.Range("Q197:T207") '
rngInput.ClearContents
End Sub
Private Sub CommandButton7_Click()
Dim slcr As SlicerCache
For Each slcr In ActiveWorkbook.SlicerCaches
slcr.ClearManualFilter
Next slcr
End Sub
这是针对不同数据集的一系列比较按钮的代码,每个按钮都有一个“清除数据”按钮。最后,我在最后有一个“清除切片机”按钮。
之前有效,但点击按钮后,它不再在单元格T63中显示数据(对于命令按钮1)
据我所知,代码没有改变 - 导致问题的原因是什么?
由于
答案 0 :(得分:0)
此声明是否没有列引用? 代码:
rTable.Cells(rTable.Cells.Count).Value