I use the macro below to pull data from 4 tables on a web page. D12 contains the username I'm looking for and the macro pulls all of the data related to that user and pastes it into the same sheet starting at C30.
I need another version of this macro that will take a list of usernames and enter the web data on a new tab for each of the users in the list. So if A5 = JoeB123, the macro will go to the web page, get the data in the 4 tables, and then paste it into a new tab named JorB123 in the same file. Then if A6 = BobM123, it'll do the same thing for him and for as many usernames I have in my list after that.
I'm not smart enough to figure this out.
-------
Sub NameME()
'
Dim UserName As String
UserName = ActiveSheet.Range("D12")
Range("D30").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://userbase.myco.com/cgi-bin/userwho.pl?id=" & UserName, Destination:= _
Range("$C$30"))
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "8,9,10,11"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
I need another version of this macro that will take a list of usernames and enter the web data on a new tab for each of the users in the list. So if A5 = JoeB123, the macro will go to the web page, get the data in the 4 tables, and then paste it into a new tab named JorB123 in the same file. Then if A6 = BobM123, it'll do the same thing for him and for as many usernames I have in my list after that.
I'm not smart enough to figure this out.
-------
Sub NameME()
'
Dim UserName As String
UserName = ActiveSheet.Range("D12")
Range("D30").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://userbase.myco.com/cgi-bin/userwho.pl?id=" & UserName, Destination:= _
Range("$C$30"))
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "8,9,10,11"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub