From the course: Excel: Learning VBA
Unlock the full course today
Join today to access over 24,300 courses taught by industry experts.
Trigger a procedure using a specific key sequence - Microsoft Excel Tutorial
From the course: Excel: Learning VBA
Trigger a procedure using a specific key sequence
- [Instructor] Many Excel users prefer to use keyboard shortcuts instead of the mouse to manipulate the program. If you or your coworkers would rather press a key sequence to run a macro, you can assign one either in VBA, or within the program. In this movie, I will show you how to do it in VBA. My sample file is 07_03_OnKey, and you can find it in the Ch07 folder of the Exercise Files collection. I assume that you are familiar with the macros dialog box, and that you can assign a keyboard shortcut when you record a macro. So I will focus on the Visual Basic solution. If you look at the workbook, you can see that I have a customer prize generation. And the idea, as you see here in B4, is that a customer can press the F4 key to run a macro that will display their prize. I'll do so right now, and then we'll take a look at the code. So I'll press F4, and your prize is a case of olive oil. Click OK. F4 again. Event…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Run a procedure when you open, close, or save a workbook5m 35s
-
(Locked)
Run a procedure when a cell range changes5m 37s
-
(Locked)
Trigger a procedure using a specific key sequence3m 48s
-
(Locked)
Challenge: Use Excel events in your VBA code3m 9s
-
(Locked)
Solution: Use Excel events in your VBA code3m 30s
-
(Locked)
-