Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am making a report that is get its data from workbook. Now the report is
already made i.e. the charts and tables ar done but the input data is old. Therefore I have a macro that searches the new info and (tries to) update the charts and tables. I have a problem though with getting the charts to work. The code works like this: 1) I specifiy certain headings to search for and stores the address of the these cells. and then use these cells as point of reference to get the indata. Code: If index = 0 Then varWorksheetInfoArray(0) = "Data" varWorksheetInfoArray(1) = "Value" varWorksheetInfoArray(2) = "Exchange rate" varWorksheetInfoArray(3) = "Inflation" end if Call chartMaker1(varWorksheetInfoArray) I then call a sub that is to replace to old values in the charts with the new ones. Private Sub chartMaker1(ByRef varWorksheetInfoArray() As Variant) Dim i, j As Integer Dim rng1, rng2, rng3, rng4 As Range In here I look for the addresses that I need (all these things work..) If IsEmpty(varWorksheetInfoArray(0)) = False Then Set rng1 = Worksheets(varWorksheetInfoArray(0)).Cells.Find(va rWorksheetInfoArray(1), LookIn:=xlValues) etc.. I then iterate my way through the data to get the correct range (that also works). Neverthe i and j that are coming they work and specifies the addresses that sets the range. Now here comes my problem. I try to get new info to the charts by writing: Sheets("Rapport").Select ActiveSheet.ChartObjects("Diagram 2").Activate With ActiveChart .SeriesCollection(1).Values = Range(rng2.Offset(i, 0).Address & ":" & rng2.Offset(j, 0).Address) .SeriesCollection(2).Values = Range(rng3.Offset(i, 0).Address & ":" & rng3.Offset(j, 0).Address) .SeriesCollection(1).XValues = Sheets(varWorksheetInfoArray(0)).Range(rng1.Offset (i, 0).Address, rng1.Offset(j, 0).Address) End With and it just does not work. All addresses etc. ar correct, it is just the syntax how to get the new info to the charts that is not working..Please I would be very thankful if anyone oculd help me!! Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Making a chart | Excel Discussion (Misc queries) | |||
Making a chart | Charts and Charting in Excel | |||
making a chart | Excel Discussion (Misc queries) | |||
Chart making | Charts and Charting in Excel | |||
Making a chart | Charts and Charting in Excel |