Tolong dibantu. Tentang vba

  1. 5 tahun lalu

    Tolong di bantu tentang vba
    saya ngg tau gmana caranya memasukkan nomor/rate di excel menggunakan vba
    ini code vba saya.

    Sub Get_Web_Data()
    ' TeachExcel.com
    
    Dim request As Object
    Dim response As String
    Dim html As New HTMLDocument
    Dim Website As String
    Dim price As Variant
    
    
    
    ' Website to go to.
    Website = "https://www.g2g.com/wow-us/gold-2299-19249?&server=30955&faction=543&sorting=price@asc"
    
    ' Create the object that will make the webpage request.
    Set request = CreateObject("MSXML2.XMLHTTP")
    
    ' Where to go and how to go there - probably don't need to change this.
    request.Open "GET", Website, False
    
    ' Get fresh data.
    request.setRequestHeader "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"
    
    ' Send the request for the webpage.
    request.send
    
    ' Get the webpage response data into a variable.
    response = StrConv(request.responseBody, vbUnicode)
    
    ' Put the webpage into an html object to make data references easier.
    html.body.innerHTML = response
    
    ' Get the price from the specified element on the page.
    Range("a1") = html.getElementsByClassName("products__exch-rate").Item(0).innerText
    
    End Sub

    Pls tolong di bantu

  2. Caton

    25 Oct 2019 Terverifikasi Indonesia + 20.102 Poin

    @sucyresky ...

    Contoh revisi script di atas:

    Sub Get_Web_Data()
        Dim request As Object
        Dim response As String
        Dim html As New HTMLDocument
        Dim Website As String
        Dim price As Variant
        Dim sTemp As String
    
        Website = "https://www.g2g.com/wow-us/gold-2299-19249?&server=30955&faction=543&sorting=price@asc"
        
        Set request = CreateObject("MSXML2.XMLHTTP")
        
        With request
            .Open "GET", Website, False
            .setRequestHeader "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"
            .send
        
            response = StrConv(.responseBody, vbUnicode)
        End With
        
        html.body.innerHTML = response
        sTemp = html.getElementsByClassName("products__exch-rate").Item(0).innerText
    
        '+-- Cari teks yang akan dibuang.
        If InStr(1, sTemp, "1 Gold = ") Then
            sTemp = Replace(sTemp, "1 Gold = ", "")
        End If
    
        Range("A1") = sTemp
    End Sub

    Demikian.

  3. Makasi mas, udah bisa

  4. tahun lalu

    ini pake vba bagaimana kak ?

 

atau Mendaftar untuk ikut berdiskusi!