Extract dropdown list from web?

cspengel

Board Regular
Joined
Oct 29, 2022
Messages
173
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
This is the link I am wanting to extract.


What I would like to do is select the Fanduel option then pull the date it lists and put it into cell P19 on my excel sheet, and also pull the list of games in the dropdown box if the text contains "(Sg)"

Is this possible?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
After much fiddling around, this is what I have

VBA Code:
Dim objIE, listCbo1,  cOption
 Dim i As Long
 Dim rng As Range
 Dim ws As Worksheet

    Set ws = ThisWorkbook.Worksheets("Main")
    Set objIE = CreateObject("InternetExplorer.Application")
    objIE.Visible = True
    objIE.navigate "https://www.sabersim.com/dfs/nba/projections/"


    While objIE.Busy
        Application.Wait TimeSerial(Hour(Now), Minute(Now), Second(Now) + 4)
    Wend
  
 objIE.document.getElementById("fd1").Click
   
    While objIE.Busy
        Application.Wait TimeSerial(Hour(Now), Minute(Now), Second(Now) + 4)
    Wend
   
    i = 23
   Set listCbo1 = objIE.document.getElementsByTagName("option")
   For Each cOption In listCbo1
   If InStr(cOption.Value, "Sg") > 0 Then
 Worksheets("Main").Cells(i, "P").Value = cOption.innerText
 End If
 i = i + 1
Next cOption

Set rng = ws.Range("L19")
With rng.Validation
        .Delete
        .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
        xlBetween, Formula1:="=$P$27:$P$35"
        .IgnoreBlank = True
        .InCellDropdown = True
        .InputTitle = ""
        .ErrorTitle = ""
        .InputMessage = ""
        .ErrorMessage = ""
        .ShowInput = True
        .ShowError = True
    End With

End Sub

Is it somehow possible to remove the source of the validation? I want to use the values in P27:P35 as the data validation criteria, but I do not want those cells to remain with that criteria after the validation criteria is filled if that makes sense...
 
Upvote 0
Is it somehow possible to remove the source of the validation? I want to use the values in P27:P35 as the data validation criteria, but I do not want those cells to remain with that criteria after the validation criteria is filled if that makes sense...
Change Formula1 to a csv string of values, like this:
VBA Code:
Formula1:=Join(Application.Transpose(Range("P27:P35").Value), ",")
Or create the csv string directly in the For Each cOption In listCbo1 loop instead of populating the cells and use that string as the Formula1 value.
 
Upvote 0
Solution
Change Formula1 to a csv string of values, like this:
VBA Code:
Formula1:=Join(Application.Transpose(Range("P27:P35").Value), ",")
Or create the csv string directly in the For Each cOption In listCbo1 loop instead of populating the cells and use that string as the Formula1 value.
Thank you John_w!!
 
Upvote 0

Forum statistics

Threads
1,214,650
Messages
6,120,734
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top