Monday, December 11, 2006

Handy Excel Macros - 1

Handy.

Sub WalkAndPause()
' run a series of URL that take a parameter
' Give them some time to complete
' before running more
doMe

alertTime = Now

For myCount = 1 To 50

alertTime = alertTime + TimeValue("00:00:45")
Application.OnTime alertTime, "doMe"

Next myCount

End Sub

Sub doMe()
'Follow the links in the sheet - 3 at a time

Selection.Hyperlinks(1).Follow NewWindow:=False, _
AddHistory:=False
ActiveCell.Offset(1).Select
Selection.Hyperlinks(1).Follow NewWindow:=False, _
AddHistory:=False
ActiveCell.Offset(1).Select
Selection.Hyperlinks(1).Follow NewWindow:=False, _
AddHistory:=False
ActiveCell.Offset(1).Select
End Sub

Sub fixLink()
' Run down a list of URLs in a sheet and
' turn them into recognizable URLs

melink = ActiveCell.Value

ActiveSheet.Hyperlinks.Add Anchor:=Selection, _
Address:= melink _
, TextToDisplay:= melink

ActiveCell.Offset(1).Select

If ActiveCell.Value <> "" Then

fixLink

End If

End Sub

0 Comments:

Post a Comment

<< Home