(Solved) – Request to complete this VBA code for get Result it will help me to get complete my project please help me

(solved)-–-request-to-complete-this-vba-code-for-get-result-it-will-help-me-to-get-complete-my-project-please-help-me

Sub getDataForExcel()
Dim ie As InternetExplorer
Dim ht As HTMLDocument
Dim wb As Workbook
Dim ws As Worksheet
Dim rng As Range
Dim symbol As String
Dim n As Integer
Dim lastrow As Long
‘Dim ltpPrice As Integer

Set wb = ActiveWorkbook   
Set ws = Sheets("Sheet1")   
   'ws.Activate   

'Last row find  
   lastrow = ws.Cells(Rows.Count, "A").End(xlUp).Row  
   Set rng = ws.Range("A2:A" & lastrow)   

 n = 2   
 For Each x In rng     
 symbol = x   

 Set ie = New InternetExplorer   
 ie.Visible = True    
 ie.navigate ("https://nseindia.com/get-quotes/equity?symbol=" & symbol & "")  

Do Until ie.readyState = READYSTATE_COMPLETE
DoEvents
Loop

Set ht = ie.Document    

Set ltpPrice = ht.getElementById("quoteLtp")   
MsgBox ltpPrice   

'i = 1   
'For Each ltp In ltpPrice    
'    Sheet1.Cells(i, 2).Value = ltp.innerText    
'    i = i   1    
'Next   
Next x   

End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *