Exp19_Excel_Ch12_Cap_Bulldog_Collectibles | Exp19_Excel_Ch12_Cap_Inventory
You are the operations manager for Bulldog collectables, a small start-up company that deals with sports memorabilia. As you prepare to document your inventory, you decide to utilize a template to save time. To complete this task, you will create a worksheet based on an Office.com template; you will also use the Macro Recorder and Visual Basic for Application to automate sorting and calculations within the workbook.
Start Excel. Download and open the file named EXP19_Excel_Ch12_Cap_Inventory.xlsx. Grader has automatically added your last name to the beginning of the filename.
Delete the Inventory Pick List and Bin Lookup worksheets.
Delete the INVENTORY PICK LIST and BIN LOOKUP icons located respectively in cells E2 and F2. Then Clear all existing Data Validation in the range A1:K15.
Delete the values in the range B5:J15.
Record a macro named Sort, be sure to use relative references. Ensure the macro sorts the data in the table in ascending order based on SKU (column A). Stop the Macro Recorder and Save the workbook as a Macro-Enabled Template.
Create a form control button that spans the cell E2:E3. Assign the Sort macro and edit the button text to Sort.
Use the VBA Editor to create a new module.
Type the following VBA code to create a custom Inventory Value function then save and exit the VBA Editor (be sure to leave a blank line between each line and before End Function):
Function InventoryValue (QTY, COST)
InventoryValue = QTY * COST
Click cell J5 and use the newly created InventoryValue function to calculate the value of the inventory for each item in column I.
Use the VBA Editor to create a new module named ProtectWorkbook. Type the following VBA statements to create the sub procedure (leave appropriate line spacing).
‘Protect workbook using the password eXploring
Worksheets(“Inventory List”).Protect Password:=”eXploring”
Insert a new module named UnprotectWorkbook. Type the following VBA statements to create the sub procedure and then save and exit the VBA Editor (leave appropriate line spacing).
‘Unprotect workbook using the password eXploring
Worksheets(“Inventory List”).Unprotect Password:=”eXploring”
Insert a Form Control Button spanning cells F2:F3 named Unprotect. Assign the UnprotectWorkbook macro to the newly created Control Button.
Insert a Form Control Button spanning the range G2:H3 named Protect. Assign the macro ProtectWorkbook.
Insert the comment Inventory based on values in column J. in cell B3 (include the period).
Insert the comment Count of items in column C. in cell C3 (include the period).
Inspect the document for private information and hidden properties. Save the file when prompted then remove Document Properties and Personal Information, and Headers and Footers.
Note: Mac users, from the Excel menu, open your preferences, click Security, and then click the check box to Remove personal information from this file on save. Delete any headers or footers in the workbook.
Check the document for accessibility issues. Use the Accessibility Checker pane to change the cell styles to Normal in order to repair the issue.
Check the document for compatibility with Excel 2010, 2013, and 2016.
Note: Mac users, skip this step.
Insert a new worksheet named Code.
Open the VBA Editor, open Module 1, and copy the code. Paste the code in the Code worksheet starting in cell A1.
In the VBA Editor, open Module 2, and copy the code. Paste the code in the Code worksheet starting in cell A22.
In the VBA Editor, open the ProtectWorkbook, and copy the code. Paste the code in the Code worksheet starting in cell A28.
In the VBA Editor, open the UnprotectWorkbook module, and copy the code. Paste the code in the Code worksheet starting in cell A35.
Close the VBA Editor and save the workbook as an xlsx file (not Macro-Enabled).
Close EXP19_Excel_Ch12_CAP_Inventory.xlsx. Exit Excel. Submit the file as directed.