VBA Code to Rotate Shape


I have a spreadsheet that updates by advanced filters. I have my shape rotation value pointed to the cell that contains that value. If I manally input the number, it changes the rotation, but when I run the advanced filter to bring up the data it does not change the rotation. The value that I have in cell W2 changes, but the rotation does not. How can I make it change the rotation when the filter is applied?

My code is as follows:

Private Sub Worksheet_Change(ByVal Target As Range)

    With Target

        If .Address = Range("W2").Address Then

            Shapes("Group 174").Rotation = Range("w2").Value * 258

        End If

    End With

End Sub




Your code runs on the Change event. It doesn't run when cell W2 isn't changed. It's possible that the Change even doesn't occur if the value of W2 was modified by the filter. In that case you would need to find another event to trigger the rotation.


Answer the Question

You must create an account to use the forum. Create an Account or Login