Hi Everyone,

I am having some issues running some vb to go to the internet and fill out a form based on what i have in my excel. I'm hoping someone can help me out with what i'm doing incorrectly.

In column a i have client name, date from, date to, and utilization. I fill out the first three items in column b, and im trying to get it to return the utilization.

The code below works perfectly when i step through it (F8), but when i just run it directly it completely skips through the part where it is supposed to input the data into the text fields. Can anyone identify why it would do that?

Sub Worksheet_Change(ByVal Target As Range)
    If Target.Row = Range("ClientName").Row And Target.Column = Range("ClientName").Column Then
        Dim IE As New InternetExplorer
        IE.navigate "WEBPAGEHERE" 'sorry, company website so i cant post the link, wouldnt work
                                              ' anyways because its a site accessed only when on the server.
        IE.Visible = True
    
        Do
            DoEvents
        Loop Until IE.readyState = READYSTATE_COMPLETE
        Dim Doc As HTMLDocument
        Set Doc = IE.document
        IE.document.Links(1).Click
        Do
            DoEvents
        Loop Until IE.readyState = READYSTATE_COMPLETE
        '----->
        
  Dim IE_Element As Object
  Dim IE_HTMLCollection As Object
  Dim ClientName$, FromDate$, ToDate$
  ClientName = Range("ClientName")
  FromDate = Range("Date_From")
  ToDate = Range("Date_to")
  
    Set IE_HTMLCollection = IE.document.getElementsByTagName("input")
        For Each IE_Element In IE_HTMLCollection
            If IE_Element.Name = "txtClientPerfER" Then IE_Element.innerText = ClientName
            If IE_Element.Name = "txtFromDate" Then IE_Element.innerText = FromDate
            If IE_Element.Name = "txtToDate" Then IE_Element.innerText = ToDate
            If IE_Element.Name = "btnClientPerf" Then IE_Element.Click
        Do
            DoEvents
        Loop Until IE.readyState = READYSTATE_COMPLETE
        Next

    End If
    
End Sub
Thanks for the help!