bracken752
New Member
- Joined
- Aug 15, 2013
- Messages
- 44
Hey all,
I have been following the forum for some time now and this is the first time I couldn't find something that hasn't already been asked before.
I'm using web queries to pull data from a website with over 300 different pages of data (a page for each user which around 4115 cell lines (which is fine as my macro only pulls 4-5 sets of web queries at a time). What I want is that when the information is pulled for the macro to rename the sheet from for example "Sheet1" to the information in cell B and C (Users First name (Cell b) and Surname (Cell C).
I have tried using the macro record to simply run through it manually, (Pull the data, create new sheet, copy cell B1:C1 and rename - paste into box) but the macro just picks up the name, so all sheets following that will be "John Smith" even though only the first sheet was called John Smith.
Any ideas?
For your information:
The code I'm using is as follows (Important URL information and names changed):
I have been following the forum for some time now and this is the first time I couldn't find something that hasn't already been asked before.
I'm using web queries to pull data from a website with over 300 different pages of data (a page for each user which around 4115 cell lines (which is fine as my macro only pulls 4-5 sets of web queries at a time). What I want is that when the information is pulled for the macro to rename the sheet from for example "Sheet1" to the information in cell B and C (Users First name (Cell b) and Surname (Cell C).
I have tried using the macro record to simply run through it manually, (Pull the data, create new sheet, copy cell B1:C1 and rename - paste into box) but the macro just picks up the name, so all sheets following that will be "John Smith" even though only the first sheet was called John Smith.
Any ideas?
For your information:
The code I'm using is as follows (Important URL information and names changed):
Code:
ActiveWorkbook.Worksheets.Add With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.*Removed*.net/RestrictedPages/UserDetail.aspx?userID=36", _
Destination:=Range("$A$1"))
.Name = "UserDetail.aspx?userID=36"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Range("B2:C2").Select
Selection.Copy
Sheets("Sheet6").Select
Sheets("Sheet6").John Smith