ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I insert an image into a specific cell within a protected . (https://www.excelbanter.com/excel-discussion-misc-queries/3202-how-do-i-insert-image-into-specific-cell-within-protected.html)

Scott Peebles

How do I insert an image into a specific cell within a protected .
 
How do I insert an image into a specific cell within a protected worksheet.
I have created an order form that is protected so users can only enter data
into specific cells. However, I would like users to be able to insert a
graphic file/image into a specific set of merged cells. Please help.

Thanks,
Scott


Dave Peterson

I think I'd give them a macro to do it.

The macro would ask for the filename, unprotect the sheet, add the graphic to
the correct location, and reprotect the sheet.

Option Explicit
Sub testme02()

Dim myPictureName As Variant
Dim myPict As Picture
Dim myRng As Range

myPictureName = Application.GetOpenFilename _
(filefilter:="Picture Files,*.jpg;*.bmp;*.tif;*.gif")

If myPictureName = False Then
Exit Sub 'user hit cancel
End If

With Worksheets("sheet1")
.Unprotect Password:="hi"
Set myRng = .Range("A1:e10")
Set myPict = .Pictures.Insert(myPictureName)
myPict.Top = myRng.Top
myPict.Width = myRng.Width
myPict.Height = myRng.Height
myPict.Left = myRng.Left
myPict.Placement = xlMoveAndSize
.Protect Password:="hi"
End With
End Sub

Scott Peebles wrote:

How do I insert an image into a specific cell within a protected worksheet.
I have created an order form that is protected so users can only enter data
into specific cells. However, I would like users to be able to insert a
graphic file/image into a specific set of merged cells. Please help.

Thanks,
Scott


--

Dave Peterson


All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com