Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,670
Default Please help on coding the macro.

SOS - Please Help

Does anyone have any suggestion on how to load a web link instead of opening
a file? Please see the coding at the bottom.

Instead of a list of file names on column A under Lists worksheet, it is a
list of web links on column A under Lists worksheet.
For example,
In cell A2, there is http://www.myurl.com/john.html
In cell A3, there is http://www.myurl.com/1.html

I would like to load a list of web links one by one into Temp worksheet,
after the
first web link is loaded from cell A2 under Lists worksheet, then retrieve
the
value in cell A10 under Temp worksheet and paste this value into Z2 under
Lists worksheet. After that,

repeat for the next web links ...

after the second link is loaded from cell A3 under Lists worksheet, then
retrieve the value in cell A10 under Temp worksheet and paste this value into
Z3 under Lists worksheet.

repeat for the next web links until the end of the lists

Does anyone have any suggestions?
Thank anyone very much for any suggestions
Eric

=====
Coding
=====

Sub Updating_Lists()

Dim myRng As Range
Dim myCell As Range
Dim wkbk As Workbook

With Worksheets("Lists")
'still starting in row 2!
Set myRng = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
End With

For Each myCell In myRng.Cells
Set wkbk = Nothing
On Error Resume Next
On Error GoTo 0
myCell.Offset(0, 1).Value = ""
myCell.Offset(0, 2).Value = ""
myCell.Offset(0, 3).Value = ""
Next myCell

For Each myCell In myRng.Cells
Set wkbk = Nothing
On Error Resume Next
Set wkbk = Workbooks.Open(Filename:=myCell.Value, UpdateLinks:=3)
On Error GoTo 0

If wkbk Is Nothing Then
myCell.Offset(0, 1).Value = "Failed to open!"
Else
wkbk.Close savechanges:=True
myCell.Offset(0, 1).Value = "ok"
With myCell.Offset(0, 2)
.NumberFormat = "mm/dd/yyyy"
.Value = Date
End With
With myCell.Offset(0, 3)
.NumberFormat = "hh:mm:ss"
.Value = Time
End With

End If
Next myCell

'better to include an extension
Workbooks("Update Lists.xls").Close savechanges:=True

End Sub

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
HELP - Too long coding for Macro Eric Excel Worksheet Functions 12 February 22nd 08 02:55 PM
HELP - coding on Macro! Eric Excel Worksheet Functions 3 February 21st 08 12:26 AM
coding macro Boss Excel Discussion (Misc queries) 0 November 13th 07 12:17 PM
How to use the if statement for Macro coding? Eric Excel Worksheet Functions 3 June 19th 07 04:16 PM
soft-coding lines in a macro GJR3599 Excel Discussion (Misc queries) 1 March 30th 05 10:28 PM


All times are GMT +1. The time now is 09:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"