excel - Plotting separate charts for columns below each merged cell dynamically -


what changes should make in ranges of code below code search each unique merged cell, , and plot chart of columns below merged cell particular department. can have dynamic number of columns below different merged cells (like different number of months). also, number of departments dynamic. suggest other changes in code this. (i have used 'columnmax' in code used long ranges, , used in place of '7')

kindly find data here sample chart http://bit.ly/1drovfs . want code plot same type of charts departments dynamically.

code following:

sub charts() dim rchart1 range dim icolumn long dim lastcol4 long dim currentrcol long dim cht1 chart  lastcol4 = activesheet.cells(2, activesheet.columns.count).end(xltoleft).column const strtrow long = 1 const endrow long = 7 dim columnmax long columnmax = lastcol4 - 4  activesheet  set rchart1 = .range(.cells(strtrow, "a"), .cells(endrow, "a"))  icolumn = 2 7 step 2 set rchart1 = union(rchart1, .range(.cells(strtrow, icolumn), .cells(endrow, icolumn))) next  set cht1 = .shapes.addchart.chart  cht1   .parent.left = .parent.left - .parent.width / 2   .charttype = xlcolumnclustered   .setsourcedata rchart1, xlcolumns  end end end sub 


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -