dj44
01-01-2017, 10:42 AM
Hi folks,
:) Happy new 2017 to all.
I am trying to assign some macros to my shapes.
Shape Name
Macro
Shape1
Test1
Shape2
Test2
Shape3
test3
Sub ShapeMacros()
Dim ws As Worksheet
Dim i As Integer
Dim oShp As Shape
Set ws = Worksheets("Shapes")
For i = 3 To ws.Cells(ws.Rows.Count, "B").End(xlUp).Row
Set oShp = ws.Shapes(ws.Cells(i, "A").Name).Value
oShp.OnAction = ws.Cells(i, "B").Value2
Next i
End Sub
I cant seem to understand why there is an error, it should work
Please point me to where the syntax is wrong
thank you
:) Happy new 2017 to all.
I am trying to assign some macros to my shapes.
Shape Name
Macro
Shape1
Test1
Shape2
Test2
Shape3
test3
Sub ShapeMacros()
Dim ws As Worksheet
Dim i As Integer
Dim oShp As Shape
Set ws = Worksheets("Shapes")
For i = 3 To ws.Cells(ws.Rows.Count, "B").End(xlUp).Row
Set oShp = ws.Shapes(ws.Cells(i, "A").Name).Value
oShp.OnAction = ws.Cells(i, "B").Value2
Next i
End Sub
I cant seem to understand why there is an error, it should work
Please point me to where the syntax is wrong
thank you