I have a pivot table and a Column (AA) with Value next to the pivot table. I'm making a code that when I change the pivot table (e.g by selecting slicer): 1. If Range("AA11: AA5000") is not empty, a prompt message will ask whether want to clear the data in column AA? 2. But if Range("AA11: AA5000") is empty, no need to show the msgbox. However, when I write the code below, it does not work. I try to change Range to Cell("AA11") then it works. But I want range instead of Cells. Can you help me? TIA.
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
If IsEmpty(Range("AA11:AA50000")) = False Then
Dim answer As VbMsgBoxResult
answer = MsgBox("Do you want to clear the data?", vbYesNo, "Clear Data")
If answer = vbYes Then
Call ClearPreviousData
End If
End If
End Sub