Locked lesson.
About this lesson
How to run a macro from the Macro dialog.
Exercise files
Download this lesson’s exercise file.
Running Macros: Using the Macro dialog.xlsm21.8 KB
Quick reference
Running Macros: Using the Macro dialog
Running Macros via the Macros dialog
When to use
When you want to see what macros exist in the file, or run a macro
Instructions
Open the Macros dialog via either of the following methods:
- Click on the Macros icon in the Developer tab
- Press Alt + F8
Make sure the macro you want to run is selected and click Run.
Hints & tips
- If you open a file containing a macro from an un-trusted source, a prompt will appear under the ribbon warning you that the file contains a macro, and asking if you would like to enable the macro. If you say no, you will not be able to run your macros.
- If you open a file from a trusted source, then you will not receive this prompt
- 00:05 So now how do we know it all worked?
- 00:07 Well first thing, remember, we save the file before we actually go and run it.
- 00:12 And now what we're gonna do is we're just gonna go and
- 00:13 we're gonna throw some numbers in here.
- 00:15 I'm gonna put another $1,000 in this area here.
- 00:17 So if everything works correctly and I hit my macro and
- 00:21 it rolls forward, what we should see Is that we should
- 00:24 see that our opening balance here we'll go up 7500 from this area.
- 00:29 Our opening balance for the Safety Supply should drop to 1551.
- 00:33 This area should be at wiped out, and
- 00:35 we should see that we get to March 31st 2017 up in the top.
- 00:39 Question is, how do we actually go about doing that?
- 00:42 Now we have a couple of ways to launch this next dialogue.
- 00:45 The first way we can do it is we can go and we can click the macros dialogue.
- 00:49 And that will actually take this into this particular area right here.
- 00:53 You'll notice that here is row four which has our macro.
- 00:56 So at this point, I also have, for reference, the ability to change from
- 01:00 all open workbooks to this workbook to just the items in continuity schedule.
- 01:05 This will list all of the other open workbooks in my system.
- 01:08 In this case here, this workbook is fine, all open workbooks is fine.
- 01:12 It shows me all the macros that are available.
- 01:14 What I'd like to do right now is I'd just like to click on this guy and
- 01:17 we're gonna click Run.
- 01:19 And you'll notice that it hops around, it does some stuff.
- 01:23 7500, or 1500 here, this looks like it's good.
- 01:25 The date has advanced to March 31st so everything looks good there.
- 01:29 So let's go now and say, you know what, let's try this a different way, I'm gonna
- 01:33 take $4000 out of this one here, and I'm gonna take $1500 out of this one here.
- 01:37 Oops, not 15,000.
- 01:38 There we go.
- 01:39 That's better.
- 01:40 So we're gonna bring these guys down a little bit, but
- 01:42 I'd like to do this a slightly different way.
- 01:45 So I'm gonna press Alt+F8.
- 01:47 And Alt+F8 is the keyboard shortcut to bring up this macro dialog area.
- 01:54 So this is kinda cool now.
- 01:56 We can go and we can again say Run.
- 01:59 And it will go through, and you can see that the values have indeed decreased.
- 02:03 So this is all good.
- 02:05 Now.
- 02:07 Can I do this as many times as I want?
- 02:08 Well, absolutely.
- 02:09 I can go through and I can say, you know what?
- 02:11 Let's run, that's cool, let's go and run it again.
- 02:14 And then I might realize that no, I've gone too far.
- 02:17 I didn't really wanna do that or maybe something wasn't right in the macro
- 02:20 because it was copying over something else or breaking something and
- 02:23 this is the challenge.
- 02:24 This is why we saved first.
- 02:25 So now we can go and we can say file.
- 02:28 Now we can say you know what, let's close.
- 02:31 Don't save.
- 02:33 And we throw these things away.
- 02:35 Now gonna show you something kind of interesting here.
- 02:39 Remember, I saved this into a folder within my documents folder.
- 02:43 And of course, I'd already set that up as a trusted location.
- 02:47 So here's the difference between these things.
- 02:49 If I go and minimize this,
- 02:50 I have a second file that looks the same, which is called Macro from Desktop.
- 02:53 And it's stored on my desk top.
- 02:55 So I'm gonna double click on this and open it up in Excel.
- 02:58 And you'll notice that I've got a security warning, Macros have been disabled.
- 03:01 Okay, it's telling me, hey this was run from a location that is not trusted.
- 03:05 And therefore, I need to tell you that there's a macro enabled or
- 03:09 a macro in here.
- 03:10 If I want to use it at this point in time, I can go in and
- 03:13 I can do anything I want to this.
- 03:15 So I can say it, there we go.
- 03:17 I can try and go and run things but it won't, well it actually gives me some
- 03:20 kinda funky little things on this thing, and it will still let me do it.
- 03:24 But the big key here is that it was prompting to let me know that something us
- 03:27 going on in there.
- 03:28 If I clicked the yellow box, it would have gone away and
- 03:30 everything would have been fine.
- 03:31 In this case here, I'm now gona go and say close.
- 03:34 And I'm gonna show you what happens when we launch this from a recent location.
- 03:39 Here's Continuity Schedule or Continuity.xlsm,
- 03:42 which you can see is stored in the file types and saving area.
- 03:46 So I'm gonna go and open that one up.
- 03:47 And you'll notice, there's no prompting.
- 03:49 And when I go into my macros, everything looks just like you did before.
- 03:53 So this is why, remember, we set up that trusted location for the documents folder.
- 03:58 And we're storing these particular files inside the trusted location for
- 04:02 the document folder.
- 04:04 That way when they open,
- 04:05 we already know that everything within that area is already considered safe.
- 04:09 So it's gonna run without prompting, okay?
- 04:11 So that's two things.
- 04:13 Number one is how to run your macro from two different places,
- 04:18 either through the macros dialog or by pressing Alt+F8.
- 04:21 And the Alt+F8 keystroke,
- 04:22 by the way, will work whether the developer tab is showing or not.
- 04:26 Okay, so that's always available to you.
- 04:28 And then the second thing is what actually happens, how that trusted
- 04:32 location folder actually changes what actually happens when things open.
- 04:35 So the beautiful thing there is that if you develop the stuff and you send it out
- 04:39 to your users, even if they haven't set up any trusted folders, that's no problem.
- 04:44 They'll actually get prompted, and it says, hey, would you want to enable this?
- 04:46 It may even actually ask them, would you like to store this as a trusted document,
- 04:50 and then it won't prompt them again for that particular file.
- 04:52 So it's a nice security model in that case.
- 04:55 Nice and friendly and works well to allow us to only execute trusted macros.
Lesson notes are only available for subscribers.