Unveiled: Creating Charts for customized rows and columns in Excel

Basically the program was done by macro(in Excel). I just tailored some portions to make it use for my application. You can use this program the same way…

Sub Macro1()

‘ Macro1 Macro
‘Dim r1 As Range, r2 As Range, r3 As Range, r4 As Range
‘Dim i As Long

‘Dim myMultiAreaRange As Range

For i = 6 To 26
Worksheets(“mi”).Activate
Set r1 = Cells(4, 2)
Set r2 = Range(Cells(4, 27), Cells(4, 34))
Set r3 = Cells(i, 2)
Set r4 = Range(Cells(i, 27), Cells(i, 34))
Set myMultiAreaRange = Union(r1, r2, r3, r4)
myMultiAreaRange.Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Union(r1, r2, r3, r4)
ActiveChart.ChartType = xl3DColumnClustered
Next i

End Sub

Explanation:

The variable ‘i’ used here denotes starting row and ending row where the program loops on the datas present. Using Range() and cell() you could selected particular data needed for plotting charts. simple!!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s