R
Richard1284
Hi sorry but that last thread, here is my code I want to display a
different pic as each button s clicked however as I click the button I
also want to delete the old one. I am having problems with the latter.
I haave outlined where there is an error in my code, can you please
check it out and give me some ideas on what to do?
Much appreciated
Public myPic As Picture '
Public sPic As String
Sub InsertPic1()
'
' InsertPic1 Macro
' Macro recorded 23/05/2004 by Richard
sPic = Sheets("Main").Cells(100, 6).Value
------------------------------------------------------------
'error here on trying to detect if there is already a pic on sheet
If sPic <> "" Then
'I get the error here
Set myPic = ActiveSheet.Pictures(sPic)
myPic.Delete
End If
--------------------------------------------------------------
sPic = ("F:\Dss\ass\Arran1.jpg")
Sheets("Main").Select
Range("D16").Select
Set myPic = ActiveSheet.Pictures.Insert(sPic)
'storing pic ref here for delete
Sheets("Main").Cells(100, 6).Value = sPic
End Sub
different pic as each button s clicked however as I click the button I
also want to delete the old one. I am having problems with the latter.
I haave outlined where there is an error in my code, can you please
check it out and give me some ideas on what to do?
Much appreciated
Public myPic As Picture '
Public sPic As String
Sub InsertPic1()
'
' InsertPic1 Macro
' Macro recorded 23/05/2004 by Richard
sPic = Sheets("Main").Cells(100, 6).Value
------------------------------------------------------------
'error here on trying to detect if there is already a pic on sheet
If sPic <> "" Then
'I get the error here
Set myPic = ActiveSheet.Pictures(sPic)
myPic.Delete
End If
--------------------------------------------------------------
sPic = ("F:\Dss\ass\Arran1.jpg")
Sheets("Main").Select
Range("D16").Select
Set myPic = ActiveSheet.Pictures.Insert(sPic)
'storing pic ref here for delete
Sheets("Main").Cells(100, 6).Value = sPic
End Sub