How to create dynamic column chart?

ZionX

New Member
Joined
Mar 17, 2011
Messages
11
this is the data source i have:
<table style="width: 448px; height: 584px;" border="0" cellpadding="0" cellspacing="0"><col style="width:48pt" width="64"> <col style="mso-width-source:userset;mso-width-alt:4937;width:101pt" width="135"> <col style="mso-width-source:userset;mso-width-alt:4242;width:87pt" width="116"> <tbody><tr style="height:15.0pt" height="20"> <td style="height:15.0pt;width:48pt" height="20" width="64">s_id</td> <td style="width:101pt" width="135">Team</td> <td style="width:87pt" width="116">suppliername</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">14</td> <td>Material Costing</td> <td>elec</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">14</td> <td>Material Costing</td> <td>elec</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">14</td> <td>Material Costing</td> <td>elec</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">14</td> <td>Material Costing</td> <td>elec</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">14</td> <td>Material Costing</td> <td>elec</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">14</td> <td>Tactical</td> <td>elec</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">14</td> <td>Tactical</td> <td>elec</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">14</td> <td>Tactical</td> <td>elec</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">14</td> <td>Tactical</td> <td>elec</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">14</td> <td>Tactical</td> <td>elec</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">15</td> <td>Material Costing</td> <td>mechanical</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">15</td> <td>Material Costing</td> <td>mechanical</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">15</td> <td>Material Costing</td> <td>mechanical</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">15</td> <td>Material Costing</td> <td>mechanical</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">15</td> <td>Material Costing</td> <td>mechanical</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">15</td> <td>Tactical</td> <td>mechanical</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">15</td> <td>Tactical</td> <td>mechanical</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">15</td> <td>Tactical</td> <td>mechanical</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">15</td> <td>Tactical</td> <td>mechanical</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" height="20" align="left">15</td> <td>Tactical</td> <td>mechanical</td> </tr> </tbody></table>

i need to create few column charts which based on the suppliername, in the example above mean i need to create 2 column charts, and i have build some coding buy jz able to create the 1st chart only
Code:
Dim IngRows As Long
Dim x As Integer
IngRows = Range("A2").CurrentRegion.Rows.Count

For x = 2 To IngRows - 1
If Not (Cells(x, 3).Text = Cells(x + 1, 3).Text) Or IsEmpty(Cells(x + 3, 3).Text) Then
Range(Cells(2, 1), Cells(x, 7)).Select

ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range(Cells(2, 1), Cells(x, 7)), PlotBy:=xlColumns
ActiveChart.ChartType = xlColumnClustered
ActiveWindow.SmallScroll Down:=-3

End If

Next x

is so weird that the loop will end once it met the if condition, instead of continue, how can I make it to continue loop and build the rest of the chart? :rofl:
Thanks for help.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,224,527
Messages
6,179,331
Members
452,907
Latest member
Roland Deschain

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