Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I want to insert a picture in an unlocked cell of a protected sheet. How do
I do that? |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
You can't. Pictures don't go in cells, they are objects over the sheet and a
protected sheet, by default, does not allow the addition of objects. "DiamondDave44" wrote: I want to insert a picture in an unlocked cell of a protected sheet. How do I do that? |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Try something like this:
Const FileTypes As String = "Picture files (*.bmp; *.gif; *.tif; " & _ "*.jpg; *.jpeg), *.bmp; *.gif; *.tif; *.jpg; *.jpeg" Sub InsertPict() Dim ws As Worksheet Dim P As Picture Dim c As Range Dim h As Single, r As Single Dim PNm As Variant Set ws = ActiveSheet 'Sheets("Pictures") ws.Unprotect Set c = ws.Range("B2") With Application PNm = .GetOpenFilename(FileTypes, Title:="Select Photo") If VarType(PNm) = vbBoolean Then Exit Sub .ScreenUpdating = False Set P = ws.Pictures.Insert(PNm) r = P.Height / P.Width 'Get proportionality ratio P.Width = c.Width P.Height = r * P.Width P.Left = c.Left P.Top = c.Top c.RowHeight = P.Height .ScreenUpdating = True End With ws.Protect Set ws = Nothing Set P = Nothing Set c = Nothing End Sub Regards, Greg "DiamondDave44" wrote: I want to insert a picture in an unlocked cell of a protected sheet. How do I do that? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I allow insert picture in sheet when it is protected | Excel Discussion (Misc queries) | |||
insert picture into protected sheet | Excel Discussion (Misc queries) | |||
How can I insert the tab name into a cell in a different shee... | Excel Discussion (Misc queries) | |||
How do I insert a comment in unlocked cell of a protected workshee | Excel Worksheet Functions | |||
How can I insert a picture from file while worksheet is protected | Excel Discussion (Misc queries) |