From the course: Excel VBA: Managing Files and Data

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Check if a worksheet exists

Check if a worksheet exists - Microsoft Excel Tutorial

From the course: Excel VBA: Managing Files and Data

Start my 1-month free trial

Check if a worksheet exists

- [Narrator] Mine of the fundamental operations that you'll perform using Excel VBA, is to check whether a worksheet exists. In this movie, I will demonstrate the code that will let you do that, my sample file is 0301 sheet exists, and that's a macro enabled Workbook you can find in the chapter three folder of the exercise files collection, I have three worksheets, and this Workbook I won't be working directly with the date in any of them. So I'll press Alt F 11, to move over to the Visual Basic Editor, And here, I have two code modules that contain procedures. The first is a function, that's what you see here with the name worksheet exists. I'll describe what to do with the function in a moment, but I want to go down to the sub routine below, called check for sheet. And what this does, is determine whether there is in fact a worksheet of a given name. So you've got the declaration for the subroutine at the top,…

Contents