Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Specify Rows For A Graph
I have a large number of daily bank balances to analyze. I created a
graph to monitor the balances. I made a drop down box to change the account. That works just fine. I created 2 more drop downs: one for the start date, the other for the end date. I want to be able to choose a range of dates easily without having to change the source data for the graph each time. The date drop downs return the row number of the date (raw data is on another sheet). For instance, October 16th is the first day on my "Historical Balances" sheet. I select October 16th as the start date and October 17th as the end date (using the drop down boxes). The cells that are linked to these boxes will have values of 1 and 2, respectively. I want a macro that will pull the data that corresponds to these rows. I have a start, but it gets stuck on the FirstRow part. The cells that have the row numbers are L6 and L7. Sub PasteDatesToGraph() Dim FirstRow As Range Dim LastRow As Range Dim DestCell As Range Dim RngToCopy As Range With Worksheets("Historical Balances") FirstRow = .Range("A" & Worksheets("Graphs").Range("L6").Value) LastRow = .Range("A" & Worksheets("Graphs").Range("L7").Value) Set RngToCopy = .Range(FirstRow, LastRow) End With With Worksheets("Graphs") Set DestCell = Worksheets("Graphs").Range("N2") End With RngToCopy.Copy _ Destination:=DestCell End Sub |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Specify Rows For A Graph
Why start a new thread?
DoooWhat wrote: I have a large number of daily bank balances to analyze. I created a graph to monitor the balances. I made a drop down box to change the account. That works just fine. I created 2 more drop downs: one for the start date, the other for the end date. I want to be able to choose a range of dates easily without having to change the source data for the graph each time. The date drop downs return the row number of the date (raw data is on another sheet). For instance, October 16th is the first day on my "Historical Balances" sheet. I select October 16th as the start date and October 17th as the end date (using the drop down boxes). The cells that are linked to these boxes will have values of 1 and 2, respectively. I want a macro that will pull the data that corresponds to these rows. I have a start, but it gets stuck on the FirstRow part. The cells that have the row numbers are L6 and L7. Sub PasteDatesToGraph() Dim FirstRow As Range Dim LastRow As Range Dim DestCell As Range Dim RngToCopy As Range With Worksheets("Historical Balances") FirstRow = .Range("A" & Worksheets("Graphs").Range("L6").Value) LastRow = .Range("A" & Worksheets("Graphs").Range("L7").Value) Set RngToCopy = .Range(FirstRow, LastRow) End With With Worksheets("Graphs") Set DestCell = Worksheets("Graphs").Range("N2") End With RngToCopy.Copy _ Destination:=DestCell End Sub -- Dave Peterson |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Specify Rows For A Graph
The OP replied in the original thread that it's working.
Dave Peterson wrote: Why start a new thread? DoooWhat wrote: I have a large number of daily bank balances to analyze. I created a graph to monitor the balances. I made a drop down box to change the account. That works just fine. I created 2 more drop downs: one for the start date, the other for the end date. I want to be able to choose a range of dates easily without having to change the source data for the graph each time. The date drop downs return the row number of the date (raw data is on another sheet). For instance, October 16th is the first day on my "Historical Balances" sheet. I select October 16th as the start date and October 17th as the end date (using the drop down boxes). The cells that are linked to these boxes will have values of 1 and 2, respectively. I want a macro that will pull the data that corresponds to these rows. I have a start, but it gets stuck on the FirstRow part. The cells that have the row numbers are L6 and L7. Sub PasteDatesToGraph() Dim FirstRow As Range Dim LastRow As Range Dim DestCell As Range Dim RngToCopy As Range With Worksheets("Historical Balances") FirstRow = .Range("A" & Worksheets("Graphs").Range("L6").Value) LastRow = .Range("A" & Worksheets("Graphs").Range("L7").Value) Set RngToCopy = .Range(FirstRow, LastRow) End With With Worksheets("Graphs") Set DestCell = Worksheets("Graphs").Range("N2") End With RngToCopy.Copy _ Destination:=DestCell End Sub -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cluster stacked graph AND line combo graph? | Charts and Charting in Excel | |||
Powerpoint Graph- Shading in between two linear graph lines | Charts and Charting in Excel | |||
Need 2 rows to display X axis data points for a line graph | Charts and Charting in Excel | |||
Hyperlinkage of one graph with another graph or Drill down graph | Charts and Charting in Excel | |||
Why are my hidden rows unhidden after I edit a graph? | Charts and Charting in Excel |