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.
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
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
Summary: Hi there! I'm just beginning the long road in learning VBA and already have an immediate need for some code that is quite beyond me. I have an excel worksheet that contains thousands of rows of data i...
Summary: Hello! I am a mechanical engineer by trade and am working in Excel to manipulate data. I have written macros in the past, but have come to a stumbling block. For simplicity say I have a column of timi...
Summary: My system is very slow on copy paste.it takes 3-4 minutes to small data. In windows if i copy paste, it is ok. but in ms office, autoCAD e.t.c if copy any thing from one file to other file it takes 3-...