2016-03-31 11 views
0

Bu, her bir hücreye erişmek ve değerini bir değişkene aktarmak için bir döngü eklediğim kod bloğunun ortasıdır.Çevrimiçi formu doldurmak için bir makro oluşturmak, döngü yanlış ayarlanmış

IE nesnesini oluşturduğum, web sitesine eriştiğim vb. Kodun bölümünü çıkardım çünkü düzgün çalışıyor gibi görünüyor. Döngü emin olmadığım şey.

Neyi değiştirmem gerekiyor?

Dim name As String 
Dim address As String 
Dim city As String 
Dim state As String 
Dim zip As String 
Dim phone As String 

Range.Row = i 

    For i = 2 To 626 

     name = Cells(A, i).Value 
     address = Cells(B, i).Value 
     city = Cells(C, i).Value 
     state = Cells(D, i).Value 
     zip = Cells(E, i).Value 
     phone = Cells(F, i).Value 

     IE.Document.all("butAdd").Click 
     If IE.Document.Title = " PestPac - Maintain Notification Locations" Then 
     IE.Document.getElementById("Name").Value = name 
     IE.Document.getElementById("Address").Value = address 
     IE.Document.getElementById("City").Value = city 
     IE.Document.getElementById("State").Value = state 
     IE.Document.getElementById("Zip").Value = zip 
     IE.Document.getElementById("Phone").Value = phone 
     IE.Document.getElementById("Distance").Value = "0.1" 

     IE.Document.all("butAdd").Click 

     Exit For 

    Next i 

End Sub 

cevap

İlgili konular