From the course: Excel: Learning VBA

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Solution: Use Excel events in your VBA code

Solution: Use Excel events in your VBA code - Microsoft Excel Tutorial

From the course: Excel: Learning VBA

Solution: Use Excel events in your VBA code

(upbeat music) - [Instructor] This movie will describe the solutions that I would use to solve the challenges that I offered in the previous movie. The sample file is "07_05_Solution." You can find it in the chapter seven folder of the "Exercise Files" collection. And here, you see I've already opened it, and I have the message box, "Your challenge: find the Auto_Open event code in the VBA project," and I'll click okay. And from here I'll press Alt F11 to move to the Visual Basic editor. The code that you're looking for is not in the "ThisWorkbook" module or on the "Sheet1" module, instead Auto_Open is left over from Excel 4, and it goes into a "Regular Code" module. So, for that I will go over to the Project explorer and click the "Show detail" button next to "Modules." And you see here I have "Module1," so I'll double click that, and I have the "RandomPrize" macro at the top. And then if you scroll down, you'll see…

Contents