In this project, you will create a macro that will assign a heading required on all reports. You will then modify the macro by changing the Visual Basic Code. You will copy the finalized macro code into a blank sheet in the workbook, and then save the macro-enabled workbook in the Excel Workbook (.xlsx) format.
Open the Excel workbook Excel_9E_DLP_Accounting_as.xlsx downloaded with this project. Ensure that the Developer tab is enabled.
On Sheet1, with cell A1 selected, begin to record a macro. Name the macro as Accounting_Macro and assign CTRL+r as the Shortcut key. Do not close the Macro dialog box. (Mac users, assign Option + Cmd + r)
Store the macro in this workbook, and enter the text Fills in report heading as the description. Close the dialog box. While recording the macro, be sure to follow the steps exactly as specified. Do not switch between windows or worksheets in between steps.
In Sheet 1, in recording mode, insert two blank rows, one at a time, at the top of the worksheet.
In cell A1, type DLP Accounting. Merge and center the text you just typed across the range A1:E1, and then apply the Title cell style.
In cell A2, type Quarterly Report. Merge and center the text you just typed across the range A2:E2, and then apply the Heading 1 cell style.
Center the worksheet horizontally, click cell A1, and then stop recording the macro. Delete rows 1:2, return to cell A1, press CTRL+R to run the macro and ensure that the macro works as expected.
In the Microsoft Visual Basic for Applications window, copy the entire Accounting_Macro macro including the Sub statement to the End Sub statement. Paste the code into cell A1 of Sheet2.
In the Microsoft Visual Basic for Applications window, in the fourth line following the first End With, edit Quarterly Report to indicate Quarterly Operations Report.
On Sheet 1, delete rows 1:2, return to cell A1, press CTRL+R to run the macro again and ensure that the macro works as expected.
In the Microsoft Visual Basic for Applications window, copy the Accounting_Macro code between the first End With and the second With. There should be five lines of code, including the line that you changed. Paste the code into cell A1 of Sheet3. The VBA code should display in cells A1:A5 when pasted.
- 13 days ago
Purchase the answer to view it