Excelllllllllllllllllllll
Board Regular
- Joined
- Jun 13, 2017
- Messages
- 108
Hi all, I'll break this down into 2 parts - the problem and what I've come up with.
1. I have a line graph that I'd like to change the source data for depending on 2 cell change macro.
In sheet "By Day" I have 53 weeks and 7 days in them (columns B to NH or 2-372). And I have 94 sites (rows 5-99).
In a different sheet "Daily Graph" I have 1 cell with a dropdown menu for Mon-Sun (A2) and another cell where you can select all the site names (B2). And I have a line graph.
I need this line graph to show all the days selected for the site selected. E.g. if Site 3 and Tuesday are selected I need the graph to show me 53 points corresponding to the 53 Tuesdays that relate to site 3.
2. What I have right now.
I'm not very experienced in excel VBA and I tried doing something with integer by setting "For i = 2 to 372 Step 7" for columns, but I can't make it select them all together and I have no idea how to select the proper site.
Now I'm trying to manually make a macro with IFs that will cover ALL possible days and site combinations (which is going to be very time consuming), butt I'm stuck at how to add several source cells into the graph. Right now I have:
But I actually need something like
Still, this is only for the specific site that is in Row 5 and I'll have to do this 6 more times for that site and 93 more times times 7 for the other sites.
If anyone has a better idea of how I can achieve my goal, I would be forever indebted to your friendly and helpful self.
If not, I would be equally as grateful if someone helps me figure out how to stop getting an error using the code that I've come up with.
Either way, I thank you guys for reading this far and (maybe) helping me out!
1. I have a line graph that I'd like to change the source data for depending on 2 cell change macro.
In sheet "By Day" I have 53 weeks and 7 days in them (columns B to NH or 2-372). And I have 94 sites (rows 5-99).
In a different sheet "Daily Graph" I have 1 cell with a dropdown menu for Mon-Sun (A2) and another cell where you can select all the site names (B2). And I have a line graph.
I need this line graph to show all the days selected for the site selected. E.g. if Site 3 and Tuesday are selected I need the graph to show me 53 points corresponding to the 53 Tuesdays that relate to site 3.
2. What I have right now.
I'm not very experienced in excel VBA and I tried doing something with integer by setting "For i = 2 to 372 Step 7" for columns, but I can't make it select them all together and I have no idea how to select the proper site.
Now I'm trying to manually make a macro with IFs that will cover ALL possible days and site combinations (which is going to be very time consuming), butt I'm stuck at how to add several source cells into the graph. Right now I have:
Code:
[COLOR=#000000][FONT=Arial]ActiveSheet.ChartObjects("<wbr>Chart 1").Activate[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial]ActiveChart.SetSourceData Source:=Sheets("By Day").Cells(5, 2)
[/FONT][/COLOR]
But I actually need something like
Code:
ActiveSheet.ChartObjects("<wbr style="font-size: 13.3333px;">Chart 1").Activate[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial] ActiveChart.SetSourceData Source:=Sheets("By Day").Cells(5, 2) [/FONT][/COLOR][COLOR=#ff0000][FONT=Arial]and Sheets("By Day").Cells(5, 9) and Sheets("By Day").Cells(5, 16)[/FONT][/COLOR][COLOR=#000000][FONT=Arial]
[/FONT][/COLOR]
Still, this is only for the specific site that is in Row 5 and I'll have to do this 6 more times for that site and 93 more times times 7 for the other sites.
If anyone has a better idea of how I can achieve my goal, I would be forever indebted to your friendly and helpful self.
If not, I would be equally as grateful if someone helps me figure out how to stop getting an error using the code that I've come up with.
Either way, I thank you guys for reading this far and (maybe) helping me out!
Last edited: