Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Populating a chart with Updating information

4/30/2006 5/7/2006 5/14/2006 5/21/2006 5/28/2006
202 129 87 0 0
153 320 54 0 0

I have a VBA Program that is pulling data from a continuously updating
spreadsheet. As you can see after the current week(5/14/2006) there is no
data and thus zeros returned. I need to copy and paste this information into
a preexisting chart. The chart is set up exactly like the information above.
I just need it to past the data from, 4/30, 5/7, 5/14 and then next week
when 5/21 is populated have the data shift and paste 5/7, 5/14, 5/21. So
basically take the date with the last information (no zeros) associated with
it and past that and the previous two weeks data into the chart.
I hope that made since.

Thanks,

Tim

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Populating a chart with Updating information

Try:

Sub newrange()
Dim x, y, r
For x = 1 To 200
If Cells(2, x) 0 Then y = x
Next
Range(Cells(1, y - 2), Cells(3, y)).Select
r = Selection.Address
ActiveSheet.ChartObjects("Diagram 2").Activate ' Set Diagram 2 to yur Shart
name
ActiveChart.ChartArea.Select
ActiveChart.SetSourceData Source:=Sheets("Ark1").Range(r), PlotBy:=xlRows '
Set Ark1 to yur Sheet name
Range("a1").Activate
End Sub

-----------------------------------------------------



"Lost and Looking for Help" skrev:

4/30/2006 5/7/2006 5/14/2006 5/21/2006 5/28/2006
202 129 87 0 0
153 320 54 0 0

I have a VBA Program that is pulling data from a continuously updating
spreadsheet. As you can see after the current week(5/14/2006) there is no
data and thus zeros returned. I need to copy and paste this information into
a preexisting chart. The chart is set up exactly like the information above.
I just need it to past the data from, 4/30, 5/7, 5/14 and then next week
when 5/21 is populated have the data shift and paste 5/7, 5/14, 5/21. So
basically take the date with the last information (no zeros) associated with
it and past that and the previous two weeks data into the chart.
I hope that made since.

Thanks,

Tim

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Populating a chart with Updating information

Excellent, Here is the your code slightly modified to fit my application

Sub newrange()
Dim X As Integer, Y As Integer

For X = 1 To 25
If Cells(2, X) 0 Or Cells(3, X) 0 Then Y = X
Next
Range(Cells(1, Y - 10), Cells(3, Y)).Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Range("A10").Select
Selection.PasteSpecial
End Sub

And here is another example of the Chart that i am copying from and pasting
into specific cells

12/11/2005 12/18/2005 12/25/2005 1/1/2006
2 9 4
0
34 19 3
0

The problem with this code is that sometimes the data that is returned is
going to be both zero's. As you can see that the data is put into weekending
catogeries. I would some how like to use the code to look at the current
date and then copy and paste the cells that are under that date ending. So
if the current date was 12/21/2005 then everything from 12/25/2005 back to
12/11/2005 would be copied and pasted. If the current date is 12/29/2005
then everything from under 1/1/2006 to 12/18/2005be copied and pasted. All
the data that is collected during a week is stored under the last day of that
week.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Populating a chart with Updating information

ok just se ur input
its allmost midtnight here now, so have to wait
until tomorow
then ill look at it
b.reg. ex.

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
Updating Information in all worksheet. SF Excel Discussion (Misc queries) 6 June 2nd 09 06:39 PM
Excel Updating of information [email protected] Excel Worksheet Functions 0 March 5th 08 09:25 AM
Excel Updating Information Revised JohnM New Users to Excel 2 August 3rd 07 04:42 PM
Updating Header Information via VBA Brock[_2_] Excel Programming 5 June 2nd 04 05:35 PM
How do I Freeze information to keep from updating Pete Excel Programming 6 November 26th 03 04:52 PM


All times are GMT +1. The time now is 02:46 PM.

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

About Us

"It's about Microsoft Excel"