Tom’s Tutorials For Excel: Inserting a Picture at a Specific Cell on Multiple Worksheets
Suppose you have a workbook, with several worksheets that often require your company logo to be inserted at a particular cell’s location. Assuming…
• You want the picture at the top left corner of cell D3.
• The picture is named CompanyLogo.jpg
• The picture resides on your C drive in the folder named YourFilePath.
• The three destination worksheets are named Sheet1, Sheet2, and Sheet3.
…here’s one way to do that:
Sub InsertLogo() Dim sFile As String sFile = "C:\YourFilePath\CompanyLogo.jpg" If Dir(sFile) = "" Then MsgBox "Picture file was not found in path!", , "No such animal." Exit Sub End If Dim pct As Picture, iLeft#, iTop# Dim SheetList As Variant, SheetItem As Variant SheetList = Array("Sheet1", "Sheet2", "Sheet3") For Each SheetItem In SheetList With Sheets(SheetItem) With .Range("D3") iLeft = .Left: iTop = .Top End With Set pct = .Pictures.Insert(sFile) pct.Left = iLeft pct.Top = iTop End With Next SheetItem End Sub