AutoMacro's Code Library contains over 230+ ready-to-use VBA code fragments
Each piece of code is easily accessible via the menu within the Visual Basic Editor. Simply click and the code will insert directly into your code module.
Each code fragment is also accessible via ALT keyboard shortcuts. Simply press and release the ALT key, followed by the underlined letter from your desired menu:
AutoMacro gives users the ability to create their own code library. You can add up to 10 custom code folders in the Custom Code Library Toolbar:
Click this icon to create a folder:
Then from within the folder you can add or delete code and create subfolders.
The Edit Custom Code Menu allows you to edit any piece of code:
or edit the file structure by right-clicking in the Custom Code Explorer:
AutoMacro stores these custom code fragments in an XML file on your hard drive. The directory location can be changed in the Edit Form:
These code fragments can be shared across teams by placing the Custom Code Folder on a shared network drive.
You can also export the XML file to a specific folder. Use this to backup your code or to send to colleagues. Use the Restore button to import the saved XML file's code.
The settings menu contains VBA and Excel settings including:
Most Excel VBA work is manipulating objects like Ranges, Sheets, and Workbooks. You manipulate these objects by either applying a method (an action like Copy or Paste) or a property (cell value or cell color).
With a click of the mouse in AutoMacro you can apply a method or property to an object.
Columns and Rows
Ranges
Sheets
Workbooks
Ready-to-use functions to add to your toolbox.
Examples of logical commands: Ifs and Selects.
Fors and Loops are essential to automating repetitive processes. AutoMacro allows you to easily insert five of the most common types of loops:
MessageBoxes and InputBoxes allow you to easily communicate information to users or to receiving information from the user.
VBA contains many tools for working with text, dates, and times.. AutoMacro makes it easy to find the correct tool.
Text
Date and Time
This is a brief introduction to object variables in VBA. If you're already familiar, skip to the next section for information about how AutoMacro handles objects. We also recommend reviewing the variable section of our VBA Tutorial.
Excel VBA code often references workbooks, worksheets, and ranges. This looks like:
Range("A1").value = 1
Sheets("Sheet1").Delete
Workbooks("timecard.xlsm").Close
Notice the first code example above:
Range("A1").value = 1
Only the range is defined. The workbook and worksheet are not. When the workbook and/or sheet are not explicitly defined the currently active workbook or sheet is used. In other words:
Range("A1").value = 1
is the same as
Activesheet.Range("A1").value = 1
and the same as
ActiveworkbookActivesheet.Range("A1").value = 1
Instead, it's possible to specify a workbook or worksheet:
Workbooks("timecard.xlsm").Sheets("Sheet1").Range("A1").value = 1
As you can see, this is a lot to write. Imagine writing this out over and over again. Instead workbook, worksheet, and range objects can be declared as variables:
dim ws as worksheet
set ws = Workbooks("timecard.xlsm").Sheets("Sheet1")
ws.range("A1").value = 1
Now, ws can be used to reference Sheet1 of Timecard.xlsm. This is a huge time-saver and can make code easier to read. It's also necessary when working with many Loops.
Continue to the next section to learn more.
Many code fragments in AutoMacro reference workbook, worksheet, or range objects. You can choose whether AutoMacro refers to object variables or detects the currently active range/sheet/workbook and hard-codes those names .
This setting is defined here:
Option 1 (Default): Read the currently active workbook, worksheets, and/or range and hard-code them into the code fragment.
Examples:
Range("A1").value = 1
Sheets("Sheet1").Delete
Workbooks("timecard.xlsm").Close
Workbooks("timecard.xlsm").Sheets("Sheet1").Range("A1").value = 1
Option 2: Use object variables when referring to workbooks, worksheets, and ranges.
rng.value = 1
ws.Delete
wb.Close
wb.ws.rng.value = 1
To activate option 2 click the checkbox:
The Object Variable names are editable. To edit them, just click within the table:
Last modified 4 years ago.