Today, I’ll help you learn how to lock an image in Microsoft Excel.
Locking an image in Excel might seem tricky, just like keeping a sticky note in one place on a constantly shifting document. If you’ve ever struggled to keep images, logos, or charts exactly where you want them in your spreadsheet, you’re not alone. When you don’t apply the right formatting and settings for the inserted images, the pictures automatically resize when you change cell dimensions or move around the worksheet.
Follow along with me as I show you the tried and tested methods to fix images in Microsoft Excel.
Lock Image With Cell Movement
When the images are placed over cells, you can lock the movement of the image using the Size and Properties setting. Let me show you how in the easy steps below:

Choose the image in your worksheet that you wish to lock. If there is more than one image, you can also select multiple objects.

Right-click on any of the selected images and select the Size and Properties option from the context menu.

The Format Picture dialog box will open on the right side.
Click on the Properties options tree and select the Don’t move or size with cells option.
That’s it! The images in your worksheet won’t move whenever you change the dimension of the cell.
Lock Image Inside a Cell
If you place an image in a cell, the Size and Properties option won’t be available in the right-click context menu. Hence, you can’t use the Don’t move or size with cells option when inserting an image in the cell.

Instead, place an image over the cell.
Resize the image manually to fit the cell.

Now, follow the steps mentioned in the previous section to lock the image in its current position from Format Picture > Size & Properties > Properties > Don’t move or size with cells option.
Embed the Image in a Shape
Another easy way to lock an image in an Excel worksheet is by inserting the image file into the shape instead of a cell. Then, you can resize the cell to fit the shape. Now, if you position the shape on the cell, the shape will be on the cell and won’t move or resize with the cell. Now, let me show you how below:

Go to the destination worksheet and click on the Insert tab.
Now, click on the Shapes drop-down menu. You can choose any shape that you like from the menu that opens.

The usual Excel cursor will change into a crosshair.
Use that crosshair to draw the shape that you selected earlier.
Draw it as much bigger or smaller you want. However, you can always resize the shape whenever you want to.

When you’ve drawn the shape, the Shape Format tab will open automatically in the Excel ribbon menu. Please note that this tab isn’t usually available. It’ll only show up if there’s a Shape object in the Excel worksheet, and the ibject must be selected too.
Now, click on the Shape Fill drop-down menu in the Shape Styles block of the Shape Format menu.
From the context menu that opens, click on the Picture option.

The Insert Pictures dialog box will open. Choose any option that suits you. For example, you can click on the From a File option to upload the image from the local or networked storage on your PC.

The image will automatically fit the shape.
You can resize the shape to fit the destination cell on the active worksheet if needed.
Use the Protect Sheet Feature
If you want to lock the picture in the worksheet so no one can edit or remove it except you, use the Protect Sheet feature in Excel. I’ll walk you through this simple process step by step.

Select any cell on the spreadsheet and press Ctrl + A to select the entire worksheet.

Press Ctrl + 1 to open the Format Cells dialog box.
Click on the Protection tab and make sure the Locked checkbox is checkmarked.
If not, check the Locked checkbox.
Click OK to apply the changes that you’ve made there.

Now, go to the Review tab and click on the Protect Sheet command in the Protect commands block.
Enter a password that you can remember and click OK on the Protect Sheet dialog box.
You’ll see the Confirm Password dialog box. Enter the passphrase again and click OK.
Excel will lock the worksheet, and no one can edit it unless you unlock the sheet using the Unprotect Sheet command in the Protect block of the Review tab.
Use Excel VBA to Lock Images
If you’re looking for VBA macro-based automation in your worksheet to lock images, this section is specifically useful. Sometimes, you might find yourself needing to lock many image files in multiple worksheets in the same workbook or in different workbooks, It’s better to use an automated method, like an Excel VBA macro.
Creating a macro using VBA in Excel is pretty easy; in most cases, you don’t need to write the script yourself. For example, I’ll be sharing the simple and proven VBA scripts below to help you automate this task.
Before getting started with creating the macros, go through this Microsoft Excel tutorial to learn the steps to set up a macro:
📒 Read More: How To Use The VBA Code You Find Online
If you’ve learned and memorized the required steps to set up a VBA macro, continue with the steps mentioned below to lock an image in its position or lock a picture so no one can edit it.
Lock Image
This Excel VBA script enables you to lock all the images of the active worksheet in their respective locations:

Sub LockAllImages()
Dim ws As Worksheet
Dim shp As Shape
' Set the active worksheet
Set ws = ActiveSheet
' Loop through all shapes in the worksheet
For Each shp In ws.Shapes
' Check if the shape is a picture
If shp.Type = msoPicture Then
' Lock position and size
shp.LockAspectRatio = msoTrue ' Keep aspect ratio
shp.Placement = xlFreeFloating ' Ensures it stays in place
shp.Locked = True ' Lock object
' Protect the shape from resizing/moving
shp.OnAction = "" ' Prevent users from assigning macros
End If
Next shp
' Confirm completion
MsgBox "All images have been locked in their respective locations and sizes.", vbInformation, "Done"
End Sub
Use the above code to create a macro.

Now, press Alt + F8 to launch the Macro dialog box.
Select the LockAllImages macro from the list and hit the Run button.

The script will automatically scan the whole worksheet and lock all the images in their place.
Before using this macro, manually place the images over the cells and not in the cells.
Excel will show a confirmation dialog box to validate the script’s efficiency.
Protect Image
Use the following script to apply a password-based lock on the worksheet so no one can reposition or resize the images you’ve attached and locked earlier.

Sub LockAllObjectsWithPassword()
Dim ws As Worksheet
Dim shp As Shape
Dim password As String
' Ask the user to set a password
password = InputBox("Enter a password to protect this worksheet:", "Set Protection Password")
' Check if the user entered a password
If password = "" Then
MsgBox "No password entered. Protection canceled.", vbExclamation, "Canceled"
Exit Sub
End If
' Set the active worksheet
Set ws = ActiveSheet
' Unprotect the sheet if already protected
On Error Resume Next
ws.Unprotect
On Error GoTo 0
' Loop through all shapes in the worksheet and lock them
For Each shp In ws.Shapes
shp.LockAspectRatio = msoTrue ' Maintain aspect ratio
shp.Placement = xlMoveAndSize ' Lock in place
shp.Locked = True ' Prevent moving or resizing
Next shp
' Protect the worksheet with the entered password
ws.Protect password:=password, DrawingObjects:=True, Contents:=True, Scenarios:=True
' Confirm completion
MsgBox "All images, objects, and shapes have been locked. Worksheet is now password protected.", vbInformation, "Protection Applied"
End Sub

The VBA macro will ask you to enter a secret passcode to access the worksheet through a dialog box. Enter the password and click OK to continue.

The VBA script will lock all the objects of the worksheet, including pictures. You’ll also see a confirmation dialog box.
📚 Read more: If you liked this Excel tutorial, you’ll also love to read these recommendations:
Conclusions
So, these are some of the proven methods to lock an image in Excel. I’ve shown you how to lock both the position and size of the images. Also, I’ve shown how to prevent someone from editing worksheet images by locking those using a simple script.
Choose the method that suits your Microsoft Excel usage style and expertise level. If the guide helped you, drop a few lines in the comment box.
0 Comments