Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

VBA Code to Rotate Shape

0

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

Answer
Discuss

Answers

0

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.

Discuss


Answer the Question

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