+ Reply to Thread
Results 1 to 17 of 17

pasting data in each cell

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-30-2012
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2007
    Posts
    234

    pasting data in each cell

    does anybody know how to convert this raw data in excel, but keep them organize as possible.

    I want the win/loss record, team name, month, spread, and total in each cell.

    AIR FORCE (FT)

    (SUR: 9-4 PSR: 5-8 O-U: 3-9)

    S.04 N'W'TERN ST. L -46 65-21

    S.11 BYU# W -1' 35-14 u50

    S.18 Oklahoma W +16' 24-27 u53'

    S.25 Wyoming L -13' 20-14 u50

    O.02 NAVY L -9' 14-6 u50

    O.09 COLO. ST. L -24 49-27 o47'

    O.16* San Diego St. L -1 25-27 u53'

    O.23* Tcu L +18' 7-38 u50'

    O.30* UTAH W +7 23-28 u55

    N.06 Army W -6' 42-22 o48'

    N.13* N. MEXICO L -33 48-23 o56'

    N.18* Unlv L -19 35-20 u56'

    D.27* Georgia Tech W -2' 14-7 u55'

    (Indepedence Bowl)

    AKRON (AT)

    (SUR: 1-11 PSR: 5-7 O-U: 5-6-1)

    S.04* SYRACUSE L +8 3-29 u42

    S.11 G.-WEBB-OT L -15' 37-38 o47

    S.18* Kentucky L +24' 10-47 o51'

    S.25* Indiana W +22' 20-35 u56'

    O.02* N. ILLINOIS# L +13' 14-50 o47

    O.09 Kent St. W +17 17-28 u47

    O.16 Ohio L +16' 10-38 n48

    O.23 W. MICH. L +7' 10-56 o51

    O.30 Temple L +29' 0-30 u49'

    N.06 Ball St.-OT W +13' 30-37 o49

    N.17* MIAMI-O. W +9 14-19 u46

    N.26 BUFFALO W -1 22-14 u42'


    I plan to importing a large amount of data from the website below.

    http://www.goldsheet.com/gs_new/hist...=10cfblog.html
    Last edited by Exxcel Noob; 08-12-2012 at 11:43 PM.

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: pasting data in each cell

    Have a look at the Data--Text to columns--delimited by--- feature in Excel
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: pasting data in each cell

    Here's a Macro that will import the data into cells. Im not the greatest with web data but it will work.

    TestData.xls


      Sub testing()
        Dim URL As String
        Dim XMLHttp As MSXML2.XMLHttp
        Dim myStr As String
        Dim strTemp As Variant
        Dim arrValues() As Variant
        Dim lonPos As Long, lonEnd As Long
        Dim strStart As String, strEnd As String
        
        
        URL = "http://www.goldsheet.com/gs_new/historic.php?histlink=10cfblog.html"
        
        ActiveSheet.Cells.Clear
        Range("A1") = "Please wait processing..." & URL
        
        Set XMLHttp = New MSXML2.XMLHttp
        XMLHttp.Open "GET", URL, False
        XMLHttp.send
        myStr = XMLHttp.responseText
        Set XMLHttp = Nothing
        
        strStart = "<p>"
        strEnd = "</p>"
        
        ReDim arrValues(1 To 6, 1 To 1)
        lonPos = InStr(1, myStr, strStart, vbTextCompare)
        
        Do While lonPos > 0
            Range("A2") = "Progress: " & Format(lonPos / CLng(Len(myStr)), "0 %")
            'Move to the end of the start string
            'which happens to be the beginning of what we're looking for. :)
            lonPos = lonPos + Len(strStart)
            'Find the end string starting from where we found the start.
            lonEnd = InStr(lonPos, myStr, strEnd, vbTextCompare)
            
            If lonEnd > 0 Then
                strTemp = Replace(Mid$(myStr, lonPos, lonEnd - lonPos), "*", "")
                strTemp = Replace(strTemp, "<span></span>", "|")
                strTemp = Split(strTemp, "|")
                
                For x = 0 To UBound(strTemp)
                 arrValues(x + 1, UBound(arrValues, 2)) = "'" & strTemp(x)
                Next
                ReDim Preserve arrValues(1 To 6, 1 To UBound(arrValues, 2) + 1)
            End If
            lonPos = InStr(lonEnd, myStr, strStart, vbTextCompare)
        Loop
        arrValues = WorksheetFunction.Transpose(arrValues)
        
        Range("A1").Resize(UBound(arrValues), UBound(arrValues, 2)) = arrValues
         
        Erase arrValues
     End Sub
    Last edited by mike7952; 08-13-2012 at 02:15 AM.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  4. #4
    Forum Contributor
    Join Date
    04-30-2012
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2007
    Posts
    234

    Re: pasting data in each cell

    wow this is impressive, thank you MIKE

    i used your test data sheet and it worked.

    however, when i try to copy the macro into module and try to run it.

    i have an error message, "compile error, user define type not defined."

    am i missing something here?

    thank you mike

  5. #5
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: pasting data in each cell

    Sorry I should of told you, you need to make reference to the Microsoft XML, v3.0 or higher. Tools>References, and scroll down to you find Microsoft XML, v3.0 or higher.

    Or you can just copy this code which uses late binding to create the object

      Sub testing()
        Dim URL As String
        Dim XMLHttp As Object
        Dim myStr As String
        Dim strTemp As Variant
        Dim arrValues() As Variant
        Dim lonPos As Long, lonEnd As Long
        Dim strStart As String, strEnd As String
        
        
        URL = "http://www.goldsheet.com/gs_new/historic.php?histlink=10cfblog.html"
        
        ActiveSheet.Cells.Clear
        Range("A1") = "Please wait processing..." & URL
        
        Set XMLHttp = CreateObject("MSXML2.XMLHttp")
        XMLHttp.Open "GET", URL, False
        XMLHttp.send
        myStr = XMLHttp.responseText
        Set XMLHttp = Nothing
        
        strStart = "<p>"
        strEnd = "</p>"
        
        ReDim arrValues(1 To 6, 1 To 1)
        lonPos = InStr(1, myStr, strStart, vbTextCompare)
        
        Do While lonPos > 0
            If lonPos Mod 25 = 0 Then Range("A2") = "Progress: " & Format(lonPos / CLng(Len(myStr)), "0.0 %")
            'Move to the end of the start string
            'which happens to be the beginning of what we're looking for. :)
            lonPos = lonPos + Len(strStart)
            'Find the end string starting from where we found the start.
            lonEnd = InStr(lonPos, myStr, strEnd, vbTextCompare)
            
            If lonEnd > 0 Then
                strTemp = Replace(Mid$(myStr, lonPos, lonEnd - lonPos), " ", "")
                strTemp = Replace(strTemp, "<span></span>", "|")
                strTemp = Split(strTemp, "|")
                
                For x = 0 To UBound(strTemp)
                 arrValues(x + 1, UBound(arrValues, 2)) = "'" & strTemp(x)
                Next
                ReDim Preserve arrValues(1 To 6, 1 To UBound(arrValues, 2) + 1)
            End If
            lonPos = InStr(lonEnd, myStr, strStart, vbTextCompare)
        Loop
        arrValues = WorksheetFunction.Transpose(arrValues)
        
        Range("A1").Resize(UBound(arrValues), UBound(arrValues, 2)) = arrValues
         
        Erase arrValues
     End Sub

  6. #6
    Forum Contributor
    Join Date
    04-30-2012
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2007
    Posts
    234

    Re: pasting data in each cell

    hey mike look at this site

    http://www.goldsheet.com/gs_new/histnfl.php

    i plan to get all the data from 1993-2010 FINAL NFL SCORES & POINTSPREAD.

    is there a way to get all of them at same time?

  7. #7
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: pasting data in each cell

    Just looked them over and all the pages are set up different. So it would be to difficult.

  8. #8
    Forum Contributor
    Join Date
    04-30-2012
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2007
    Posts
    234

    Re: pasting data in each cell

    what about this format?

    http://www.goldsheet.com/gs_new/histcfb.php

    only score and pointspread

  9. #9
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: pasting data in each cell

    Yea its the same thing looks like over the years they have changed the layout of the page.
    Would by the time it took to code up something that would work on them all someone could manually enter them.

  10. #10
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: pasting data in each cell

    Heres an example this is what there old pages look like
    HTML Code: 
    and these are there new pages

    HTML Code: 

  11. #11
    Forum Contributor
    Join Date
    04-30-2012
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2007
    Posts
    234

    Re: pasting data in each cell

    dam, okay mike thank you the help.

    i wish i can get all the data with organizing format in excel

  12. #12
    Forum Contributor
    Join Date
    04-30-2012
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2007
    Posts
    234

    Re: pasting data in each cell

    hey mike i found this different site. i want to know if it still possible to collect all the data with one click?

    http://www.covers.com/pageLoader/pag...ams/teams.html

    select a team
    <baylor
    <past result (right tab on top)

    then you will see the result and each year perform.

    it is possible to collect from year 1985 to 2011?

    thank you mike

  13. #13
    Forum Contributor
    Join Date
    04-30-2012
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2007
    Posts
    234

    Re: pasting data in each cell

    so can anybody help me on this?

  14. #14
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: pasting data in each cell

    Best I could do.


    CF.xlsm

  15. #15
    Forum Contributor
    Join Date
    04-30-2012
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2007
    Posts
    234

    Re: pasting data in each cell

    WOWWWWWW MIKE !

    THIS IS UN-BELIEVABLE !

    thank you mike. i thought my computer going to crash when i press the button RUN

    this worth more than gold. i can't believe i copy and paste all this data.

    hey mike, how can i collect data for NFL, NCAA Basketball, and NBA?

    thank you MIKE!

  16. #16
    Forum Contributor
    Join Date
    04-30-2012
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2007
    Posts
    234

    Re: pasting data in each cell

    mike, how come i couldn't see the 'macro step' for 'get team'?

  17. #17
    Forum Contributor
    Join Date
    04-30-2012
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2007
    Posts
    234

    Re: pasting data in each cell

    mike sorry, but the macro seem to have an error.

    data from 1985 to 2002 doesn't have football score for both team.

    however, from 2003 to 2011 seem to have both team score.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1