Our training courses

Other training resources

Our training venues

Why we are different

Details for RonnieSG

RonnieSG has participated in the following threads:

Added by RonnieSG on 15 Jun 2021 at 05:58

Hi Andrew,

I would like to down download of element with you.

WebPage: https://sg.finance.yahoo.com/quote/MSFT/key-statistics?p=MSFT

Data: Market cap (intra-day) : 1.96T

I manage to download as 1.96 but how do I get the full underlying data of 1,957,379,833,856.0

 

Thanks

Added by RonnieSG on 14 Jun 2021 at 03:54

Hi Andrew,

 

Thanks for the reply.  I wrote some macro in excel VBA using Selenium. but the download seems very slow, anyway to solve the issue?

 

Sub GetCurrency()

Call ClearCurrency

    Dim ws As Worksheet
    Dim SingleRow As Range
    Dim ListofRows As Range
    Dim SingleColumn As Range
    Dim ListofColumns As Range
    Dim MyRange As Range
    Dim RowNum As Integer
    Dim ColNum As Integer

    Set ws = ThisWorkbook.Worksheets("Currency")

'=================================================================
'Setting Range
'=================================================================
    With ws
        Set ListofRows = Range("A3", Range("A2").End(xlDown))
        Set ListofColumns = Range("B1", Range("B1").End(xlToRight))
        Set MyRange = ws.Range(ListofRows, ListofColumns)
    End With
'=================================================================
'Loop Through RIC
'=================================================================
    RowNum = 3
    
    For Each SingleRow In ListofRows

        Dim URL As String: URL = "https://sg.finance.yahoo.com/quote/SGD=X"
        Set cd = New Selenium.ChromeDriver
        cd.AddArgument "--headless"
        cd.Start
        cd.Get URL
        Application.Wait Now + TimeValue("00:00:20")
            
'=================================================================
'Loop Through XPATH
'=================================================================
        
        Dim PathInput As Selenium.WebElement
        Dim PathResult As Variant
        
        ColNum = 2
        
        For Each SingleColumn In ListofColumns
            Set PathInput = cd.FindElementByXPath(SingleColumn)
            cd.Wait 1000
            PathResult = cd.FindElementByXPath(SingleColumn).Text
            
'=================================================================
'Output to Excel
'=================================================================
           
            Cells(RowNum, ColNum).Value = PathResult
            ColNum = ColNum + 1
        Next SingleColumn
        
        RowNum = RowNum + 1
    
    Next SingleRow
    
    Range("A1").CurrentRegion.Font.Size = 9
    Range("A1").CurrentRegion.Font.Name = "Calibri"
    Range(Range("c3", Range("c2").End(xlDown)), Range("C3", Range("C3").End(xlToRight))).Select
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
        

End Sub

Added by RonnieSG on 10 Jun 2021 at 06:57

Hi,

 

I am trying to download some specific data from Yahoo finance, I would like to check, how do I copy the data into excel using Selenium

 

Sub GetData()

    Dim myrng As Range
    Dim lastRow As Long
    Dim row_count As Long
    Dim ws As Worksheet
    Dim ticker As Variant
        
    Set ws = Sheets("Main")
   
'=================================================================
'Find Last Row
'=================================================================
    With ws
        lastRow = .Range("A" & .Rows.Count).End(xlUp).Row
    End With
'=================================================================
'Find Ticker Range
'=================================================================
    Set myrng = ws.Range(Cells(2, 1), Cells(lastRow, 1))
'=================================================================
'Loop Through Tickers
'=================================================================
  
        Set cd = New Selenium.ChromeDriver
        cd.Start
        cd.Get https://finance.yahoo.com/quote/MSFT?p=MSFT&.tsrc=fin-srch
    
'=================================================================
'Finding Elements
'=================================================================
    
        Dim SearchInput As Selenium.WebElement
                
        Set SearchInput = cd.FindElementByXPath("/html/body/div[1]/div/div/div[1]/div/div[2]/div/div/div[5]/div/div/div/div[3]/div[1]/div/span[1]")

 

 

 

Thanks       

Head office

Kingsmoor House

Railway Street

GLOSSOP

SK13 2AA

London

Landmark Offices

99 Bishopsgate

LONDON

EC2M 3XD

Manchester

Holiday Inn

25 Aytoun Street

MANCHESTER

M1 3AE

© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.

End of small page here
Please be aware that our website uses cookies!
I'm OK with this Tell me more ...