Setting chart columns

domekker

New Member
Joined
Feb 23, 2022
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hello,
I need to set range for 2 certain column for many charts. I allways create chart from 1 column It is name and surname, and then next column ec. column (A1:A49 and B1:C49) next loop(A1:A49 and C1C:49) - I am leaving the column B. next(A1:A49 and D1:D49) -I am leaving the column C

Sub CreatingCharts()

Dim ch As Chart
Set ch = Charts.Add

With ch
.ChartType = xlColumnClustered
.SetSourceData Source:=Sheets("Sheet1").Range("A1:A49,C1:C49")
.Location Where:=xlLocationAsObject, Name:="Sheet2"
End With

With ActiveChart
.Parent.Top = Range("A1").Top
.Parent.Left = Range("A1").Left
.Parent.Height = Range("A1:G30").Height
.Parent.Width = Range("A1:G30").Width
End With


End Sub
Thank You in advance
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,214,659
Messages
6,120,783
Members
448,992
Latest member
prabhuk279

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top