Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to get a picture to insert and am following the suggestion below.
After pasting the code into the View Code window the following error appears on the first Dim statement in the code. I get "Microsoft Visual Basic Complie Error: Expected: End of Statement". What am I doing wrong? Copy the code below, right click the sheet tab, select "View Code" and paste the code into the window that appears. I've assumed that your pictures are stored on a sheet named "Pictures" and that Jane Doe's picture is named "Jane Doe", and that the cell you want to enter the name into is cell A2, so that the picture appears in cell A1. HTH, Bernie MS Excel MVP Private Sub Worksheet_Change(ByVal Target As Range) Dim myShape As Shape Dim SC As Range Dim mySh As Worksheet If Target.Cells.Count 1 Then Exit Sub If Target.Address < "$A$2" Then Exit Sub Application.EnableEvents = False Application.ScreenUpdating = False Set mySht = ActiveSheet On Error Resume Next For Each myShape In mySht.Shapes If myShape.Name Like "*Final" Then myShape.Delete Next myShape Worksheets("Pictures").Select ActiveSheet.Shapes(Target.Value).Select Selection.Copy mySht.Select Target.Offset(-1, 0).Select ActiveSheet.Paste Selection.Name = "'" & mySht.Name & "'!" & Selection.Name & "Final" Target.Select Application.EnableEvents = True Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy picture and remove event code | Excel Programming | |||
insert a picture in to a comment but picture not save on hard disk | Excel Discussion (Misc queries) | |||
Insert Picture in Pivot Table with code VB | Excel Programming | |||
Insert VBA code with a macro in a .xls file by workbook open event | Excel Programming | |||
Code to Insert a picture using VC++ | Excel Programming |