I am looking for a more efficient way to write a macro (a sample from the macro is below). This is just the first part of the macro. I need to repeat these same steps (seen for row 5 below) for rows 5 to 50. My script worked until I hit row 35 and then I got the "compile error.." message. There must be a way to use "loop" to write this more efficiently, no?
If Range("M5") = 1 Then
Worksheets("ICON").Select
Worksheets("ICON").Shapes("Picture 5").Copy
Range("A1").Select
Worksheets("dashboard").Select
Range("H5").Select
ActiveSheet.Paste
Range("A1").Select
End If
If Range("M5") = 2 Then
Worksheets("ICON").Select
Worksheets("ICON").Shapes("Picture 6").Copy
Range("A1").Select
Worksheets("dashboard").Select
Range("H5").Select
ActiveSheet.Paste
Range("A1").Select
End If
If Range("M5") = 3 Then
Worksheets("ICON").Select
Worksheets("ICON").Shapes("Picture 7").Copy
Range("A1").Select
Worksheets("dashboard").Select
Range("H5").Select
ActiveSheet.Paste
Range("A1").Select
End If
Range("A1").Select
If Range("N5") = 1 Then
Worksheets("ICON").Select
Worksheets("ICON").Shapes("Picture 8").Copy
Range("A1").Select
Worksheets("dashboard").Select
Range("I5").Select
ActiveSheet.Paste
Range("A1").Select
End If
If Range("N5") = 2 Then
Worksheets("ICON").Select
Worksheets("ICON").Shapes("Picture 9").Copy
Range("A1").Select
Worksheets("dashboard").Select
Range("I5").Select
ActiveSheet.Paste
Range("A1").Select
End If
If Range("N5") = 3 Then
Worksheets("ICON").Select
Worksheets("ICON").Shapes("Picture 10").Copy
Range("A1").Select
Worksheets("dashboard").Select
Range("I5").Select
ActiveSheet.Paste
Range("A1").Select
End If
Bookmarks