From the course: Excel Copilot: Building and Maintaining VBA Macros

Unlock this course with a free trial

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

Solution: Optimizing an existing macro

Solution: Optimizing an existing macro

(upbeat music) - [Instructor] I hope you had some fun with this challenge. Now, let's walk through the solution. To keep things simple and comprehensive, we're going to jump right into strengthening the VBA version first, and then refactor the same logic into Office Scripts. That's not always the real world order. You might build in VBA, and then slowly migrate, or start in Office Scripts with clear requirements, but for learning purposes, we'll do both back to back here. Here's what we'll start with Copilot. First, we'll take our macro as it exists currently. I'll head into Copilot. (mouse clicks) I'll put this in here with the back ticks, and then, again, to get started, we are looking for error catching. We want to know how could this macro crash, how could it fail, what might go wrong here. So Copilot will give us some ideas on what might make this macro crash. We could try to implement some of these if we wish.…

Contents