Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cluster stacked graph AND line combo graph? [email protected] Charts and Charting in Excel 6 October 14th 06 12:33 AM
Powerpoint Graph- Shading in between two linear graph lines TerenYoung Charts and Charting in Excel 1 June 15th 06 09:29 AM
Need 2 rows to display X axis data points for a line graph SusanG Charts and Charting in Excel 1 March 8th 06 05:34 PM
Hyperlinkage of one graph with another graph or Drill down graph Sanjay Kumar Singh Charts and Charting in Excel 1 January 3rd 06 12:22 PM
Why are my hidden rows unhidden after I edit a graph? JazaJoswick Charts and Charting in Excel 0 August 12th 05 09:24 PM


All times are GMT +1. The time now is 06:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"