Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy picture based on a variable 1

Status
Not open for further replies.

kasparov

Programmer
Feb 13, 2002
203
0
0
GB
I want to copy a certain picture (photo) from one sheet to another depending on the value of a variable. So if the variable = 1 then I copy Picture 1 if it's 2 I copy Picture 2 etc.

I have this to copy a hardcoded picture:

Code:
Sub CopyOnePicture()
Dim wsSource As Worksheet
Dim wsDest As Worksheet

    Set wsSource = Worksheets("Who")
    Set wsDest = Worksheets("table")

    Set pic = wsSource.Pictures("Picture 2")

    pic.Copy
    wsDest.Paste

    With wsDest.Pictures(wsDest.Pictures.Count)
        .Left = pic.Left
        .Top = pic.Top
    End With

End Sub

Can someone tell me what the syntax is to change "Picture 2" to something like "Picture x"

Thanks, Chris
 
Thanks you Tony - easy when you know how. But I didn't :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top