Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
equine investor
 
Posts: n/a
Default macro help in workbooks


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

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
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
How to automatic calculation and macro execution between 3 workbooks? c Excel Worksheet Functions 1 July 22nd 05 05:38 AM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Macro in all workbooks Pam Coleman Excel Discussion (Misc queries) 2 February 24th 05 07:49 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 12:43 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"