...
Instructions
Section 9.1: Macros
Macros are created in Excel using VBA code. They are accessible and can be run on a keyboard. However, screen readers are a bit finicky with them. When macros are accessed via Simply put, macros are a tool that automates repetitive tasks in Excel, helping you save time. For instance, imagine you manage a customer database that requires alphanumeric data only. Often, you receive large Excel files with special characters (like dashes in phone numbers). Instead of spending hours manually cleaning the data to remove non-alphanumeric characters, you can use a macro to complete the task in seconds.
Macros are built using VBA (Visual Basic for Applications) code. The simplest way to create a macro is by recording your mouse clicks through a button found on the Developer tab in the Ribbon. This process allows Excel to automatically generate and store the necessary code for you. For more advanced users, there's also the option to write VBA code directly within the Visual Basic Editor.
The good news is that macros can be accessed and executed entirely using the keyboard. However, using them with screen readers can be tricky. When navigating to macros through the Developer tab on the Ribbon using only the with keyboard shortcuts, both JAWS and NVDA do read out the titles of each macro. But However, NVDA only reads the description of the first macro on the list (if there are multiple ones) — and not the others, even in the list—even when you navigate to them, and JAWS doesn’t read the description others—while JAWS does not read any descriptions at all. ThereforeBecause of this, it’s important to provide complete details crucial to include detailed information about each macro directly within the body of the Excel document. Each macro must have a meaningful name that matches its function. One other thing to mention is that Additionally, there is no text alert confirmation that when a macro has run successfully. But, you will receive a text alert if there is an error within the macro.runs successfully. However, if an error occurs while attempting to run a macro, an alert will appear.
For this example, we will create a macro for a button.
Go to the Developer Tab.
Click Insert, and in the Form Controls section, click the Form Control button.
Click and drag in cell B1 to create a button at a size you want.
The Assign Macro box will appear, click Cancel.
Now double click your button and type “Clear Form.”
Now that your button is made, we need to assign a macro and use some VBA code to make the button perform an action. To do this,
Go to the Developer Tab and click Visual Basic.
In the Visual Basic box, click Insert and choose Module.
In the text box, type in the code for your button.
In the code, it says “Are you sure you want to clear the form?” This is in the code because a person can read “Clear Form” and know what it is. But a screen reader will not be able to read the Clear Form button. Just that a button is present. This question will be read by the screen reader and will alert the reader.
Be sure you made changes to the code if you need it. For example, changing the range to reach your whole form.
When you click the button, the question will pop up. If you answer “Yes”, the form will be cleared. If you answer “No,” nothing will happen.
Right click your button and click Assign Macro in the expansion menu.
In the pop-up box, click the Clear Form Macro and click OK.
Go back to the Developers Tab and click on the Macros button.
In the pop-up box, click the Options button and change the short cut to Control + Shift + C.
Clicking those buttons in that order will allow students who only use keyboards to use the macros and clear the sheet.
To fulfill accessibility requirements, add instructions to cell A1 on how to use the Clear Form button.
To make your macros accessible, follow these steps.
...