Worksheet_Change from a data validation list [Closed]

Report
-
Posts
7096
Registration date
Saturday April 7, 2007
Status
Moderator
Last seen
February 22, 2021
-
Hello,

I want my pivots to rebuilt when a value in range("Book_Select") is changed. This range is a drop down data valiation list. What is wrong with my code:

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = Range("book_select") Then
Application.Cursor = xlWait
Call BuildPivots
Application.Cursor = xlDefault
Else
End If



End Sub



1 reply

Posts
7096
Registration date
Saturday April 7, 2007
Status
Moderator
Last seen
February 22, 2021
483
Hi,

Try something like that (not tested) :
Private Sub Worksheet_Change(ByVal Target As Range) 
Dim MyPlage, Cell As Range 
     
Set MyPlage = Range("book_select") 
     
    For Each Cell In MyPlage 
        Application.Cursor = xlWait 
        Call BuildPivots 
        Application.Cursor = xlDefault 
    Next 
End Sub 



Best regards
"Pour trouver une solution à ses problèmes, il faut s'en donner la peine."

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!