Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is Macro1() : First, make a copy of Macro10 and paste it in the same module and rename it Macro20. Then, make changes to

image text in transcribed

This is Macro1() :

image text in transcribed

First, make a copy of Macro10 and paste it in the same module and rename it Macro20. Then, make changes to Macro20 so that it creates a chart for any selected dataset. In other words, Macro10 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 Macro20 so that it asks the user for a chart title and a worksheet name. You will use the InputBox() function twice for this task. region, so no workarounds!) Hint. Testing your macro on both the data regions means you will (1) highlight the region that have the data that you want to put in your chart and then (2) run your macro to ask the user for a worksheet name that you will move your chart to, e.g., if you want the "Sales Figures for Four Cities from January to March" data, first you highlight cells A3:E6, then run your macro. Don't forget adding your comments and cleaning up the macro so it looks neater. Sub Macro1() 'Add a chart onto the active sheet and select the chart ActiveSheet.Shapes.AddChart.Select With ActiveChart 'Chart type is Clustered Bar chart .ChartType =xx BarClustered 'The data set is located in cells A3:E6 of "Sheet1" worksheet .SetSourceData Source:=Worksheets("Sheet1").Range("A3:E6") 'Set a chart title, located at the top of the chart .SetElement (msoElementChartTitleAboveChart) '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:=xILocationAsNewSheet, Name:="Sales Chart" End With First, make a copy of Macro10 and paste it in the same module and rename it Macro20. Then, make changes to Macro20 so that it creates a chart for any selected dataset. In other words, Macro10 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 Macro20 so that it asks the user for a chart title and a worksheet name. You will use the InputBox() function twice for this task. region, so no workarounds!) Hint. Testing your macro on both the data regions means you will (1) highlight the region that have the data that you want to put in your chart and then (2) run your macro to ask the user for a worksheet name that you will move your chart to, e.g., if you want the "Sales Figures for Four Cities from January to March" data, first you highlight cells A3:E6, then run your macro. Don't forget adding your comments and cleaning up the macro so it looks neater. Sub Macro1() 'Add a chart onto the active sheet and select the chart ActiveSheet.Shapes.AddChart.Select With ActiveChart 'Chart type is Clustered Bar chart .ChartType =xx BarClustered 'The data set is located in cells A3:E6 of "Sheet1" worksheet .SetSourceData Source:=Worksheets("Sheet1").Range("A3:E6") 'Set a chart title, located at the top of the chart .SetElement (msoElementChartTitleAboveChart) '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:=xILocationAsNewSheet, Name:="Sales Chart" End With

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions