Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I removed some of the unimportant code and defines.
rng_Ax = Array(4, 3, 3, 3, 6, 9, 3, 6, 9, _ 3, 2, 7, 12, 2, 7, 12, 2, 7, 4, _ 3, 6, 9, 3, 6, 9, 2, 2, 2) ' 1-3, 4, 5-9 rng_Ay = Array(5, 5, 5, 5, 5, 5, 5, 5, 5, _ 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, _ 5, 5, 5, 5, 5, 5, 4, 5, 5) rng_Bx = Array(4, 5, 3, 5, 8, 11, 5, 8, 11, _ 4, 6, 11, 16, 6, 11, 16, 6, 11, 4, _ 5, 8, 11, 5, 8, 11, 4, 6, 6) rng_By = Array(5, 5, 5, 5, 5, 5, 5, 5, 5, _ 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, _ 5, 5, 5, 5, 5, 5, 4, 5, 5) For gr_nm = 1 To 28 If range_create.Offset(gr_nm - 1, 1).Value = 1 Then ' Create and setup chart range_create.Offset(gr_nm - 1, 2) = 1 Set WS = Worksheets(tabs(t_num(gr_nm - 1))) Set chxxx = ActiveWorkbook.Charts.Add ' Setup source range Set ch_rng = WS.Range(WS.Cells(rng_Ax(gr_num), rng_Ay(gr_num)), _ WS.Cells(rng_Bx(gr_num), rng_By(gr_num))) chxxx.SetSourceData Source:=WS.Range(ch_rng, ch_rng.Offset(e_val(gr_nm))), _ PlotBy:=xlColumns ' Setup series For s_cnt = 0 To 4 If s_cnt + 1 <= DWS.Cells(gr_nm + 2, 2) Then With chxxx.SeriesCollection(s_cnt + 1) End With End If Next s_cnt End If Next gr_nm The portion of the code that isn't working is the setting of ch_rng. When I get to the following code, I get an error... With chxxx.SeriesCollection(s_cnt + 1) I get the error because the following code is not giving me the desired amount. WS.Range(WS.Cells(rng_Ax(gr_num), rng_Ay(gr_num)) In this example; rng_Ax(gr_num) = 4 rng_Ay(gr_num) = 5 rng_Bx(gr_num) = 4 rng_By(gr_num) = 5 I want the original code to end producing this Set ch_rng = WS.Range(Range("D5"), Range("D5")) and chxxx.SetSourceData Source:=WS.Range(Range("D5"), Range("D5").Offset(e_val(gr_nm))) Ax, Ay, Bx, and By vary for different cases, as can be seen in the defines. However, I get the following result: Set ch_rng = WS.Range(6043395, 6043395) Why does WS.Cells(rng_Ax(gr_num), rng_Ay(gr_num)) result in those numbers, and not in "D5"? Sorry if this is confusing, but I am almost certain there is a simple fix I haven't thought of or tried. Thanks, in advance, for all help I receive. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
min function trouble | Excel Programming | |||
Having trouble with function. | Excel Worksheet Functions | |||
IF function trouble | Excel Worksheet Functions | |||
IF FUNCTION Trouble | Excel Programming | |||
function trouble | Excel Programming |