Hi Sneha,
Thank you for your reply.
"To resolve this issue, you can specify the exact rows and columns that you want to include in the range. For example, instead of using the Range("A2:I3") function, you could use the Range("A2:I3,A5:I6,A8:I9,A11:I14,A16:I19,A21:I24,A26:I34") function to select all of the ranges of cells that you want to copy. "
My requirement is that 7 pictures need to be copied. which Range("A2:I3 to a picture and Range(A5:I6 to another picture etc.
Ultimately I want to get 7 images.
Actually, after the macro runs, I save the excel as a web page so I can get the pictures.
"Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False"
I modified the macro according to your instructions, and it works normally for the time being, but the previous macro also works normally sometimes. I will continue to test and if there are new results, I will continue to update the discussion.
I paste the modified macro so that someone can refer to it in the future.
Sub Macro1()
'
' Image Copy Macro
'
'
Range("A2:I3").Select
Selection.Copy
Range("J2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
ActiveSheet.Pictures.Paste
Application.CutCopyMode = False
Range("A5:I6").Select
Selection.Copy
Range("J5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
ActiveSheet.Pictures.Paste
Application.CutCopyMode = False
Range("A8:I9").Select
Application.CutCopyMode = False
Selection.Copy
Range("J8").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
ActiveSheet.Pictures.Paste
Application.CutCopyMode = False
Range("A11:I14").Select
Application.CutCopyMode = False
Selection.Copy
Range("J11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
ActiveSheet.Pictures.Paste
Application.CutCopyMode = False
Range("A16:I19").Select
Application.CutCopyMode = False
Selection.Copy
Range("J16").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
ActiveSheet.Pictures.Paste
Application.CutCopyMode = False
Range("A21:I24").Select
Selection.Copy
Range("J21").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
ActiveSheet.Pictures.Paste
Application.CutCopyMode = False
Range("A26:I34").Select
Selection.Copy
Range("J26").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
ActiveSheet.Pictures.Paste
Application.CutCopyMode = False
End Sub
Thank you.
Best ,
Habib