Hi,
I'll be a little verbose so you know the details...
Firstly the code:
Sub ImportData()
Sheets("Sheet2").Select
Selection.ClearContents
Sheets(2).Activate
i = 1
Do Until Sheets(1).Cells(i, 1) = ""
myquery = Sheets(1).Cells(i, 1)
Sheets(2).Cells(1, 1) = myquery
myrow = Sheets(2).UsedRange.Rows.Count + 1
Do
myrow = myrow - 1
Loop Until Sheets(2).Cells(myrow, 1) < ""
myrow = myrow + 1
With Sheets(2).QueryTables.Add(Connection:= _
"URL;" & myquery, Destination:=Sheets(2).Cells(myrow, 1))
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = False
.WebConsecutiveDelimitersAsOne = False
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = True
.Refresh BackgroundQuery:=False
.BackgroundQuery = True
.PreserveFormatting = False
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebTables = "1,2"
.WebPreFormattedTextToColumns = True
.SaveData = True
On Error Resume Next
End With
i = i + 1
Loop
With Selection.Font
.Name = "Arial"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
End With
ActiveWorkbook.Save
ChDir "C:\Documents and Settings\computer\Desktop\TAB RESULTS"
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\computer\Desktop\TAB RESULTS\1.xls",
FileFormat _
:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False
End Sub
Now the problem:
I'm currently running a macro to download race dividends from a website
based on the entries on Sheet1 ColumnA. These pages are then pasted on
Sheet2 and the data manipulated via formulae on Sheet3.
I want to modify the code instead of looping directly and pasting each
webpage on the same sheet in the same workbook, I would like to go to
cell A1 Sheet1 and use the web address to to paste the data into sheet
2, THEN save a copy of the workbook in the folder specified in the
above code.
Then use the data in cellA2 sheet 2, to do the same again.
Repeating or looping until all entries in column A have been used, then
stop the macro.
--
equine investor
------------------------------------------------------------------------
equine investor's Profile:
http://www.excelforum.com/member.php...o&userid=32507
View this thread:
http://www.excelforum.com/showthread...hreadid=522953