Reference problems

F

franzklammer

Hi! I am trying to make a chart. I cannot refer directly to the cells since
the contents and plecment in spreadsheet is variable. I have 2 problems. 1)
When choosing the area from which get data for the chart I select cells in
the wrong worksheet. when trying to add a reference regarding the worksheet i
get error. the code for this part is:

Range(rng1.Address, rng1.Offset(i, j).Address).Select

I want this code to select cells in a certain worksheet.

2) I cannot refer to multiple ranges in making the chart with indirect
reference. My code for this is:

Range(rng1.Address, rng1.Offset(i, j).Address).Select
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData
Source:=Sheets("Indata").Range("rng1.Address:rng1.Offset(1, 0).Address,
rng2.Address:rng2.Offset(3,0).Address"), PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).XValues =
Sheets("Indata").Range(rng.Offset(0, 1).Address, rng.Offset(0, i).Address)

but the program does not accept this way of defining a range. PLease help me
find the correct way!!!!!!!!
 
C

Charlie

Maybe this:

Source:=Sheets("Indata").Range(rng1.Address & ":" & rng1.Offset(1,
0).Address & ":" & rng2.Address & ":" & rng2.Offset(3, 0).Address)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Making charts 0
Range 5
Referring to multiple ranges 1
Placement of charts 0
Charts in VB 0
Chart making 0
Copy and paste entire line starting at cell W 5
Object required, fault 'No 424' 1

Top