I had an error! copy and paste this in b1.
=LEFT(A1,1) & ". " & MID(A1,SEARCH(" ", A1,1)+1,(SEARCH(" ",A1,SEARCH(" ",A1,1)+1)-1)-SEARCH(" ",A1,1))
I had an error! copy and paste this in b1.
=LEFT(A1,1) & ". " & MID(A1,SEARCH(" ", A1,1)+1,(SEARCH(" ",A1,SEARCH(" ",A1,1)+1)-1)-SEARCH(" ",A1,1))
Works great! My next question is what if the name is Jorge De La Rosa (L)?
I end up with J. De
You will need to play around with that one. Do a Google search for excel text splitting from space to bracket.
I was able to overcome my problem by using
Dim URL As Range
For Each URL In Sheets("Urls").Range("A1").Cells 'Sheet Urls is where I have the different urls to add on to the site.
ActiveWorkbook.Worksheets.Add
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;www.firstpartofsite.com/" & URL, Destination:=Range("$A$1"))
.Name = "table"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = "1"
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = True
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Next
End Sub
a12 = Jorge De La Rosa (L)
=LEFT(A12,1) & ". " & MID(A12,SEARCH(" ", A12,1)+1,(SEARCH(" (",A12,SEARCH(" ",A12,1)+1)-1)-SEARCH(" ",A12,1))
b12 = J. De La Rosa
What about getting the statistics for the pitchers from ESPN stats pages... like this...
http://espn.go.com/mlb/stats/pitchin...se/order/false
You can loop through the "count" and store all the pitcher data in a sheet, then just look up that data from the Probables page you have by pitcher?
You'd just have to adjust the pitcher count and the qualified/false or qualified/true parameters and loop through that beast and you should have all the pitching data you can handle.
Rusty or not. Point us in the direction and we should be able to help out!
This is super ghetto but it gets the job done on my end...
Code: [View]Sub GetPitchingStats() Dim startPitcher As Long Dim lastPitcher As Long Dim qualified As String Dim lastRow As Long startPitcher = 1 lastPitcher = 800 qualified = "false" lastRow = 1 Application.ScreenUpdating = False Do Until startPitcher > lastPitcher With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://espn.go.com/mlb/stats/pitching/_/count/" & startPitcher & "/qualified/" & qualified & "/order/false" _ , Destination:=Range("$A$" & lastRow)) .Name = "false" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .WebSelectionType = xlEntirePage .WebFormatting = xlWebFormattingNone .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = False .WebDisableDateRecognition = False .WebDisableRedirections = False .Refresh BackgroundQuery:=False End With 'delete all blank cells in column R Columns("R:R").Select Selection.SpecialCells(xlCellTypeBlanks).Select Selection.EntireRow.Delete 'start back at cell B1 Range("B1").Select 'add one to the last row so it starts on a blank row next time lastRow = Selection.End(xlDown).Row + 1 'increase the pitcher count by 40 startPitcher = startPitcher + 40 Loop 'a little cleanup lastRow = Range("$B$5000").End(xlUp).Row For i = 2 To lastRow If Cells(i, 2) = "PLAYER" Then Rows(i & ":" & i).EntireRow.Delete End If Next i Application.ScreenUpdating = True End Sub
In the time it took you to do that, how long would it take to accomplish it in php?
Good thread!