Hi, could someone help me with this problem please. I'm using a macro assigned to a Command Button to insert an image into an Excel worksheet, this is the code
But I now need another macro to delete the image again but not the command button (I also want to assign this new code to a command button). I've been stuggling with this for a while now and can't find anything that will work. I'd be really grateful for some help - I'm not that good on VBA but I'm trying to learn.
Many thanks, Karen
Code:
Private Sub AddLogo_Click()
ActiveSheet.Unprotect Password:="password"
Dim fName As Variant
Range("A2").Select
fName = Application.GetOpenFilename("Picture files (*.jpg;*.gif;*.bmp), *.jpgs;*.gif;*.bmp", , _
"Select the picture")
If fName = "False" Then Exit Sub
ActiveSheet.Pictures.Insert(fName).Select
With Selection.ShapeRange
.LockAspectRatio = msoFalse
.Top = Range("A2").Top
.Left = Range("A2").Left
Selection.ShapeRange.Height = 25
Selection.ShapeRange.Width = 250
Range("A2").Select
ActiveSheet.Protect Password:="password"
End With
End Sub
Many thanks, Karen