Need help turning my script into a loop

Dojorgen

Board Regular
Joined
Mar 1, 2018
Messages
59
Hey guys.....:)

Is there a way to turn this into a loop?:confused:

Worksheets("Data Entry").Select
ActiveSheet.Shapes.Range(Array("Picture 2")).Select
Selection.Copy
Range("R2").Select
ActiveSheet.Pictures.Paste.Select

Worksheets("Data Entry").Select
ActiveSheet.Shapes.Range(Array("Picture 4")).Select
Selection.Copy
Range("R3").Select
ActiveSheet.Pictures.Paste.Select

Worksheets("Data Entry").Select
ActiveSheet.Shapes.Range(Array("Picture 6")).Select
Selection.Copy
Range("R4").Select
ActiveSheet.Pictures.Paste.Select

Worksheets("Data Entry").Select
ActiveSheet.Shapes.Range(Array("Picture 8")).Select
Selection.Copy
Range("R5").Select
ActiveSheet.Pictures.Paste.Select

Worksheets("Data Entry").Select
ActiveSheet.Shapes.Range(Array("Picture 10")).Select
Selection.Copy
Range("R6").Select
ActiveSheet.Pictures.Paste.Select

Worksheets("Data Entry").Select
ActiveSheet.Shapes.Range(Array("Picture 12")).Select
Selection.Copy
Range("R7").Select
ActiveSheet.Pictures.Paste.Select

Worksheets("Data Entry").Select
ActiveSheet.Shapes.Range(Array("Picture 14")).Select
Selection.Copy
Range("R8").Select
ActiveSheet.Pictures.Paste.Select

Worksheets("Data Entry").Select
ActiveSheet.Shapes.Range(Array("Picture 16")).Select
Selection.Copy
Range("R9").Select
ActiveSheet.Pictures.Paste.Select
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
try UNTESTED

Code:
Sub MM1()
Dim n As Integer, x As Long
n = 2
x = 2
For x = 2 To 9
    With Worksheets("Data Entry")
        .Shapes.Range(Array("Picture" & n)).Copy .Range("R" & x)
    End With
n = n + 2
Next x
End Sub
 
Upvote 0
I like how you have it set up but it is not pasting the images. any ideas??? I tried to add .Pictures.Paste to the end of .Range("R" & x) but it still did not work??
 
Upvote 0
Still untested...don't have Excel

Code:
Sub MM1()
Dim n As Integer, x As Long, pic As Picture
n = 7
x = 2
For x = 2 To 9
Set pic = Worksheets("Data Entry").Pictures("Picture " & n)
    pic.Copy
With Worksheets("Data Entry")
    .Range("R" & x).Select
    .Paste
End With
n = n + 2
Next x
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,021
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top