Worksheet_Change from a data validation list

Closed
JLeeD - Feb 16, 2012 at 12:02 PM
aquarelle Posts 7140 Registration date Saturday April 7, 2007 Status Moderator Last seen March 25, 2024 - Feb 16, 2012 at 12:42 PM
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 response

aquarelle Posts 7140 Registration date Saturday April 7, 2007 Status Moderator Last seen March 25, 2024 491
Feb 16, 2012 at 12:42 PM
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."
0