Yes, you can create variables ...
the simple way!
---------------Excel Macros Mini-tutorial (continued)---------------
You can add variables to your Excel macros to make them even more useful. Most tutorials show you how to create variables using syntax that can look unfamiliar and daunting if you are not an experienced macro programmer.
As you can probably guess, I use a simpler way that is far less intimidating to people who don't understand programming.
Look at the two versions of my InsertSheets macro below:
This version of the macro is my simplified version of the macro generated by Excel's macro editor while I inserted a new worksheet and named it NewSheetName
Now look at the second version of the macro. This version allows the user to name the worksheet by entering the name in a simple input box.
Dim VariableSheetName As String
VariableSheetName = Inputbox("Sheet Name","Enter sheet name","")
Sheets.Add.Name = VariableSheetName
This is the input box ...
created by the second version of my macro. Type a name for the new sheet and click OK!
Now, wasn't THAT simple, too?!
Your homework assignment is:
Record a new macro and use the method described in this mini-lesson to create your own simple variables!