Computing.Net > Forums > Office Software > Excel-Copy paste Data download from internet

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Excel-Copy paste Data download from internet

Reply to Message Icon

Name: trader
Date: July 2, 2009 at 09:44:49 Pacific
OS: Windows Vista
Product: Microsoft Excel 2007
Subcategory: Microsoft Office
Comment:

I am downloading S&P500 data from google
finance in my excel, using automatic refresh,
with a frequency of 1 refresh per minute.
Challenge is: I want to keep a record of 10
minute prices by copy pasting this data in a
column in the same worksheet. How do I write
a macro, which copies the cell which is getting
automatic refreshed, and pastes its value in
another column in the same worksheet. please
help



Sponsored Link
Ads by Google

Response Number 1
Name: DerbyDad03
Date: July 2, 2009 at 16:58:31 Pacific
Reply:

Try this...

The assumption is that A2 is the cell that gets updated and that B2 is available to be used as a counter.

I ran with a worksheet that does a query out to the World Clock website and downloads the current time every minute. Every 10 minutes it copied the time to the next empty column in the sheet.

Buy low..Sell high!

Private Sub Worksheet_Change(ByVal Target As Range)
'Check if A2 has changed
 If Target.Address = "$A$2" Then
'If yes, then check if counter is less than 10
  If Range("B2") < 9 Then
'If yes, then increment counter
   Range("B2") = Range("B2") + 1
    Else
'If B2 = 9, then copy Column A to the 
'next empty column and reset counter
     Range("A1").EntireColumn.Copy
      Cells(1, Cells(1, Columns.Count). _
      End(xlToLeft).Column + 1).PasteSpecial (xlPasteValues)
      Range("B2") = 0
  End If
 End If
End Sub


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Excel-Copy paste Data download from internet

Excel VBA conditional copy/paste www.computing.net/answers/office/excel-vba-conditional-copypaste/9518.html

Excel Macro - sorting data www.computing.net/answers/office/excel-macro-sorting-data/5849.html

Slow Copy Paste www.computing.net/answers/office/slow-copy-paste/8171.html