akashawalker
New Member
- Joined
- May 2, 2013
- Messages
- 16
Hi to all
I have a piece of code that is working, but i would like to make it simpler by using a loop.
could someone assist me?
bellow is my code:
'%%%%%%%%%%% DELETE previous pictures from the worksheets%%%%%%%%%%%%%%%%
'Approval drawing 1
Dim myObj1
Dim Pictur
Set myObj1 = Worksheets("Approval Drawing 1").DrawingObjects
For Each Pictur In myObj1
If Left(Pictur.Name, 7) = "Picture" Then
Pictur.Select
Pictur.Delete
End If
Next
'Approval drawing 2
Dim myObj2
Set myObj2 = Worksheets("Approval Drawing 2").DrawingObjects
For Each Pictur In myObj2
If Left(Pictur.Name, 7) = "Picture" Then
Pictur.Select
Pictur.Delete
End If
Next
'Approval drawing 3
Dim myObj3
Set myObj3 = Worksheets("Approval Drawing 3").DrawingObjects
For Each Pictur In myObj3
If Left(Pictur.Name, 7) = "Picture" Then
Pictur.Select
Pictur.Delete
End If
Next
Thanks for your time
Akasha Walker
I have a piece of code that is working, but i would like to make it simpler by using a loop.
could someone assist me?
bellow is my code:
'%%%%%%%%%%% DELETE previous pictures from the worksheets%%%%%%%%%%%%%%%%
'Approval drawing 1
Dim myObj1
Dim Pictur
Set myObj1 = Worksheets("Approval Drawing 1").DrawingObjects
For Each Pictur In myObj1
If Left(Pictur.Name, 7) = "Picture" Then
Pictur.Select
Pictur.Delete
End If
Next
'Approval drawing 2
Dim myObj2
Set myObj2 = Worksheets("Approval Drawing 2").DrawingObjects
For Each Pictur In myObj2
If Left(Pictur.Name, 7) = "Picture" Then
Pictur.Select
Pictur.Delete
End If
Next
'Approval drawing 3
Dim myObj3
Set myObj3 = Worksheets("Approval Drawing 3").DrawingObjects
For Each Pictur In myObj3
If Left(Pictur.Name, 7) = "Picture" Then
Pictur.Select
Pictur.Delete
End If
Next
Thanks for your time
Akasha Walker