0
     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

This is code for a series of compare buttons for different sets of data and each one has a 'clear data' button. At the end I have a 'clear slicer' button at the end.

It was working before but after a few clicks of the button it is no longer displaying data in cell T63 (for command button one)

The code hasn't changed as far as I'm aware - what is causing the problem?

Thanks

4

1 回答 1

0

该语句是否应该没有列引用?代码:

       rTable.Cells(rTable.Cells.Count).Value
于 2013-05-25T10:23:44.790 回答