Guided Project 8-1
Boyd Logistics is developing a template with macros. To complete the template you record macros, assign them to Button form controls, edit VBA code, and create a macro-enabled workbook.
[Student Learning Outcomes 8.1, 8.2, 8.3, 8.4, 8.5]
DO NOT use the files below if you are completing an autograded SIMnet Project. Using the linked files below will prevent you from uploading and submitting your work in SIMnet. The files for all autograded SIMnet Projects MUST be downloaded from your class assignment.
Files Needed: BoydLogistics-08.xlsx (Student data files are available in the Library of your SIMnet account.)
Completed Project File Names: [your initials] Excel 8-1Template.xltm and [your initials] Excel 8-1.xlsx
Skills Covered in This Project
- Set macro security options.
- Save a macro-enabled template.
- Record a VBA macro.
- Record a macro with relative references.
- Record a macro with absolute references.
- Run VBA macros.
- Assign macros to Button form controls.
- Edit a macro in the Visual Basic Editor.
- Set macro security and display the Developer tab.
- Click the Options command [File tab] and click Trust Center in the left pane.
- Click the Trust Center Settings button and click Macro Settings in the left pane.
- Verify or select Disable VBA macros with notification and click OK. (Corporate and early Excel versions may display Disable all macros with notification.)
- Click Customize Ribbon in the left pane, display the Developer tab, and close Excel Options.
- Open the BoydLogistics-08.xlsx workbook from your student data files.
- Save the workbook as a macro-enabled template.
- Choose Save As from the File tab.
- Type [your initials] Excel 8-1Template as the file name.
- Choose Excel Macro-Enabled Template in the Save as type list. Note that the Custom Office Templates folder is selected [Figure 8-37].
- Click Save.
- Record a macro with relative references to date stamp the sheet.
- Click the Use Relative References button [Developer tab, Code group] to enable the command.
- Select cell H1.
- Click the Record Macro button [Developer tab, Code group].
- Type DateStamp in the Macro name box. You will not use a shortcut because you will assign the macro to a button.
- Verify or choose This Workbook in the Store macro in box.
- Click the Description box, type Insert date text, and click OK.
- Type =to, press Tab to select TODAY, and press Enter. This inserts today’s date in cell H1 and moves the insertion point to cell H2.
- Press the up arrow one time and press Ctrl+C. This copies today’s date to the Clipboard.
- Press Ctrl+V to paste the date in cell H1. This displays the Paste Options button (Figure 8-38).
- Click the Paste Options button and choose Paste Values. This pastes the date as text and replaces =TODAY(). The date is no longer volatile.
- Press Esc to remove the moving border.
- Click the Stop Recording button to the right of the Ready indicator in the Status bar. The ScreenTip for the button is A macro is currently recording. Click to stop recording.
- Click the Use Relative References button [Developer tab, Code group] to disable the command.
- Test the macro.
- Delete the contents of cell H1 and select cell H2.
- Click the Macros button [Developer tab, Code group].
- Select DateStamp and click Run. Today’s date is entered as text in cell H2.
- Delete the contents of cell H2.
- Record a macro with absolute references to display unique contractor names.
- Confirm that the Use Relative References button [Developer tab, Code group] is not active.
- Click the Record Macro button [Developer tab, Code group].
- Type SortUnique in the Macro name box. You will use SORT and UNIQUE from the Lookup & Reference category.
- Do not use a shortcut key.
- Verify or choose This Workbook in the Store macro in box.
- Click the Description box, type Display contractors for this period, and click OK.
- Select cell I5. This is the first code in your macro—to select cell I5.
- Click the Lookup & Reference button [Formulas tab, Function Library group] and select SORT. The Array argument is a nested UNIQUE function.
- Click the Name Box arrow, choose More Functions, and find and select UNIQUE in the Lookup & Reference category.
- Confirm that the Function Arguments dialog box is for UNIQUE and select cells B5:B32. The structured reference name Table1[Contractor] is substituted.
- Click SORT in the Formula bar to return to its Function Arguments dialog box (Figure 8-39).
- Click OK.
- Click the Stop Recording button to the right of the Ready indicator in the Status bar.
- Test the macro.
- Select cell I5 and press Delete. SORT and UNIQUE are dynamic array formulas, and the function is in the first cell of the array.
- Select cell A3.
- Click the Macros button [Developer tab, Code group], select SortUnique, and click Run. The macro runs in cell I5 as recorded.
- Select cell I5 and delete the contents.
- Assign macros to Button form controls.
- Click the Insert Controls button [Developer tab, Controls group].
- Click the Button (Form Control) command in the Form Controls category and click cell J2.
- Select DateStamp in the Assign Macro dialog box and click OK.
- Right-click the Button control and choose Edit Text.
- Delete the default text and type Stamp Date as the label.
- Right-click the control and choose Exit Edit Text. The label does not fit in the control.
- Click the Insert Controls button [Developer tab, Controls group], select the Button (Form Control) command, and click cell J5.
- Assign the SortUnique macro and edit the caption to Contractors.
- Size and align Button form controls.
- Right-click the Stamp Date button.
- Press Ctrl and right-click the Contractors control. Both controls are selected.
- Click the Align button [Shape Format tab, Arrange group] and select Align Left.
- Click the Height box [Shape Format tab, Size group] and type 0.45.
- Set the Width box [Shape Format tab, Size group] to 1.25.
- While both controls are selected, drag them so that the top-left corner of the Stamp Date control is in cell J2 (Figure 8-40).
- Click cell H1 to deselect the controls.
- Edit a VBA macro.
- Right-click the Contractors button and click the Visual Basic button [Developer tab, Code group].
- Display the Project Explorer window if necessary [View menu].
- Display the Code window [View menu], if necessary. Your macro should be in Module1.
- Edit the code line in the SortUnique macro to select cell H5 instead of I5 (Figure 8-41).
- Press Alt+F11 to return to the worksheet and click cell A3.
- Document the macros.
- Select the Documentation sheet tab.
- Type and format the information as shown in Figure 8-42.
- Delete sample data and save the template.
- Select the Stats sheet tab.
- Select and delete cells A5:F32.
- Point to the table resize arrow in cell F32 and drag up to size the table to end at cell F7. This leaves three blank rows in the template but the table will expand as needed when data is entered.
- Select cells A8:F32 and clear the formats (Figure 8-43).
- Select cell A5.
- Click Save on the title bar to save your template.
- Close the template.
- Create a workbook from the template.
- Click the File tab and select New.
- Click Personal as the category and select [your initials] Excel 8-1Template.
- Click Enable Content (or Enable Macros) if the security bar opens.
- Enter three records as shown in Figure 8-44. After the third record, press Home to return the insertion point to cell A7. If you press Enter after the third record, a blank row is added to the table. If this happens, click the Undo button to remove the blank row. (If you use the TODAY function in cell A5, the table automatically completes the column. Click the AutoCorrect Options button and undo the task.)
- Run macros in the template.
- Select cell H2 and click the Stamp Date button control.
- Select cell H5 and click the Contractors button control.
- Select cell F7 and press Tab. A new row displays and calculates in the contractor’s list as 0.
- Enter the record shown here and press Home after the last value. Note that the Contractors list in column H updates as you complete the entry.The record you need to enter starting in cell A8 on the Stats worksheet.Type today’s dateNeena BrothersMilwaukeeKansas City56569
- Select cell A5 and save your file as a macro-enabled workbook named [your initials] Excel 8-1 in your usual folder for saving files.
- Close the workbook (Figure 8-45).
- Move [your initials] Excel 8-1Template from the Custom Office Templates folder to your usual folder.
- Hide the Developer tab if instructed to do so.
Do you need help with this assignment or any other? We got you! Place your order and leave the rest to our experts.
