Hi,
I'm rather new to VBA programming in excel. All I've actually done, was to record a macro, and then modify it to create loops. I've used this code in Excel 2003 before, and it worked fine, but now, in Excel 2007, it doesn't work. I'm using this to extract data stock(query) from the web and looping it to give me a table of data. I've never built in the query into the code since I thought the query would change automatically. So now the problem is that the macro runs even before the query has been refreshed. Question is:-
1. Can I do this without adding the query code into the loop?
2. If I have to add the query in, how can I keep it simple?
Appreciate any help I can get. Thanks.
Sub UpdateCoredata()
'
' UpdateCoredata Macro
' Update Core Data from Yahoo & MSN
'
'
Sheets("Data Verification").Select
Range("A2").Select
x = 2
Do Until ActiveCell.Value = ""
Selection.Copy
Sheets("Raw Data").Select
Range("B1").Select
ActiveSheet.Paste
Refresh False
SaveData = True
Application.CutCopyMode = False
Range("B2:B10").Select
Selection.Copy
Sheets("Data Verification").Select
Cells(x, 4).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Cells(x, 1).Select
x = x + 1
ActiveCell.Offset(1, 0).Activate
Loop
End Sub
Bookmarks