Link to home
Start Free TrialLog in
Avatar of jlcannon
jlcannon

asked on

Updating Data for Excel Graph

Dear Experts,

I am trying to use vba in excel to populate one of my graphs. The data I am using is constently changing so I decided to use the end(xlup) function. It also contains data from 2 separate columns, one with the date and one with test amount. Below is the vba I am using. I do not get an error but excel will only graph the second set of data (Range("C2", Range("C200").End(xlUp).Address))

Any ideas?
Sheets("Sheet1").Select
    ActiveSheet.ChartObjects("TempGraph").Activate
    ActiveChart.SetSourceData Source:=Sheets("Data").Range("Q2", Range("Q200").End(xlUp).Address)
    ActiveChart.SetSourceData Source:=Sheets("Data").Range("C2", Range("C200").End(xlUp).Address)

Open in new window


Thank you for the help!
ASKER CERTIFIED SOLUTION
Avatar of Wim_Bl
Wim_Bl
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jlcannon
jlcannon

ASKER

Wim_Bl,

Your example looks close, but I dont think I would want to include columns C and D because I have data in those columns that pertain to a different graph. Would this make a difference?

I also do not want to add a new series. I want range Q to be my x-axis values and range C to be my y-axis values.

Thank you for the help
Got this to work. Thanks for the help.