View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
external usenet poster
 
Posts: 789
Default Can a macro read a list and insert the names into a web address?

Hi
Step1: Select your list of names with the mouse (no heading row) and
in the name box (just above the column A heading) type Webnames and
press return. This names that data range.
I'll assume the sheet you have the names on is called "My Names" and
you want to put the info on the sheet called "Team 1". Change as
required.

Step 2: Open the visual basic editor by pressing Alt+F11. You should
see VBA Project(Your workbook name) on the left hand side. Make sure
it is highlighted then do Insert, Module.

Step 3: Paste in this code

Sub MakeWebNames()
Dim WN As Range, OneName As Range
Dim Namerow As Long
Set WN = Worksheets("My Names").Range("Webnames")
Namerow = 1
With Worksheets("Team 1")
For Each OneName In WN
.Hyperlinks.Add Anchor:=.Cells(Namerow, 2), Address:= _
"http://hiscore.runescape.com/index_lite.ws?player=" &
OneName, _
TextToDisplay:="http://hiscore.runescape.com/index_lite.ws?
player=" & OneName
Namerow = Namerow + 40
Next OneName
.Columns("B").AutoFit
End With
Set WN = Nothing
End Sub

Careful with the line wrapping - it needs to look like above. You may
need to change sheet names.

Step 4: Run the macro. Go back to excel and do Tools, Macro,
Macros...Select the macro and run it.

I use Excel 2003 and XP. If you have Excel 2007 running a macro is a
bit different in terms of where it is.
regards
Paul
On Jan 27, 7:39*pm, Darren wrote:
I want to know if a macro can read a list of names (can be from 10 - 100
long) from 1 sheet and copy each name individually into a web address. Then
place the results onto another sheet at pre determined places.
Heres what I have:
On Sheet xp from cell B3 is the list of names
* * * * *b
3 *Thrasherfan
4 *Mummybear58
3 *Galadriel107

I want to read each name, 1 at a time and place them into:http://hiscore.runescape.com/index_l...er=*Insertname here*

Then place that information onto:\
Sheet Team 1, cell B1 for 1st name
Sheet Team 1, cell B41 for 2nd name
Adding 40 cells for each consecutive name. So name 3 would be B81 etc.

Is this possible, and if so, how would I go about it?