Question: Open vba_hwk4.xlsm workbook and using the Visual Basic Editor (VBE), open Module1. You will see Macro1(), which creates a Clustered Bar chart for a specific

Open vba_hwk4.xlsm workbook and using the Visual Basic Editor (VBE), open Module1. You will see Macro1(), which creates a Clustered Bar chart for a specific data region (range of cells). Your task is to make changes to Macro1() so that its usability and flexibility is improved. First, make a copy of Macro1() and paste it in the same module and rename it Macro2(). Then, make changes to Macro2() so that it creates a chart for any selected dataset. In other words, Macro1() creates a Clustered Bar chart from a dataset located at a specific data region. You cannot use it if you want to create a Clustered Bar chart from a dataset located at a different data region. Finally, improve Macro2() so that it asks the user for a chart title and a worksheet name. You will use the InputBox() function twice for this task. Test your macro on both the data regions on Sheet1. (We may test your macro on a new data region, so no workarounds!)Open vba_hwk4.xlsm workbook and using the Visual

(General) (Declarations) Option Explicit Sub Macro 10 'Add a chart onto the active sheet and select the chart ActiveSheet.Shapes.AddChart.Select With ActiveChart 'Chart type is Clustered Bar chart ChartType = xlBarClustered 'The data set is located in cells A3:E6 of "Sheet1" worksheet .SetSourceData Source: Worksheets("Sheet1"). Range("A3:56") 'Set a chart title, located at the top of the chart .SetElement (msoElementChartTitle AboveChart) 'Assign the content of cell B1 to the title of the chart .chartTitle.Text = Worksheets("Sheet1").Range("B1").Value "Move the chart to a new sheet. Name this sheet "Sales Chart" .Location Where:=xlLocationAsNewSheet, Name:="Sales Chart" End With End Sub

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related General Management Questions!