Return to VBA Code Examples

Check if Sheet and/or Range Exists Function

Check if Sheet Exists

We’ve created a function that will test if a Sheet or Range (on a particular sheet) exists. The Range test is useful if you want to check if a particular named range exists on a sheet.

 

 

Place the function within a VBA Code Module and you can access it by using sub procedures like these:

Check if Sheet Exists

 

Check if Range Exists on a Sheet

 

Adjusting the RangeExists Function

Check if Sheet Exists on Another Workbook

The above function looked at ActiveWorkbook (the currently active workbook). Instead you could adjust the Function to look at a specific workbook like this:

Implementation:

 

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users! vba save as


Learn More!