marreco
Member
Hi
I have a code to check IP's status, but i check multiple PI's in column.
I try a loop but my loop check one row only.
I want this loop go through all rows in column A.
My code based:
https://social.technet.microsoft.co...0f/ping-from-vba-in-excel?forum=officegeneral
Thank you!!
I have a code to check IP's status, but i check multiple PI's in column.
I try a loop but my loop check one row only.
I want this loop go through all rows in column A.
Code:
Sub Ping_IP()
Dim ECHO As ICMP_ECHO_REPLY
Dim pos As Long
Dim success As Long
With ActiveWorkbook.Worksheets("MySheetWith_IP")
Row = 2
Do
'#######--> begin code inside Loop <--#########
If .Cells(Row, 1) <> "" Then
If SocketsInitialize() Then
success = ping(([A2].Value), (Date), ECHO)
[B2].Value = GetStatusCode(success)
[C2].Value = ECHO.RoundTripTime & " ms"
[D2].Value = ECHO.DataSize & " bytes"
If Left$(ECHO.Data, 1) <> Chr$(0) Then
pos = InStr(ECHO.Data, Chr$(0))
[E2].Value = Left$(ECHO.Data, pos - 1)
End If
SocketsCleanup
Else
MsgBox "Socket initialisation failure!!"
End If
End If
'#######--> end code inside Loop <--#########
Row = Row + 1
Loop Until .Cells(Row, 1) = ""
End With
End Sub
https://social.technet.microsoft.co...0f/ping-from-vba-in-excel?forum=officegeneral
Thank you!!