Why isn't my code working?

cb10

New Member
Joined
Jan 5, 2012
Messages
14
Code:
[COLOR=#333333]
[/COLOR]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
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Should this statement not have a column reference?
Code:
rTable.[COLOR=#b22222]Cells(rTable.Cells.Count).[/COLOR]Value
 
Upvote 0

Forum statistics

Threads
1,221,553
Messages
6,160,468
Members
451,649
Latest member
fahad_ibnfurjan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top