How to check if a shape or image exists in active sheet?
For example, there are dozens of shapes or images already added to the active worksheet, and now you want to check if a specific shape or image exists in the active sheet. How can you quickly perform this task without checking the shapes or images one by one? Excel does not have a built-in function for this, but this article introduces a VBA code to quickly determine if a shape or image exists in the active sheet.
Check if a shape or image exists in active sheet
Check if a shape or image exists in active sheet
Please apply the below macro code to check if a specific image exists in the active sheet.
1. Press Alt + F11 keys to enable Microsoft Visual Basic for Applications window.
2. Click Insert > Module and paste below code to the script.
VBA: Check if a shape or image exists
3. Press F5 to run the code, a dialog box will appear to indicate whether the image exists in the active sheet.
![]() | ![]() |
Tip: In the macro code, you can change the image name in xCharName = "cat" to suit your requirements.
Related Articles:
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!