Clever-Excel-Forum

Normale Version: Hilfe zu VBA Script
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Hallo,

ich habe folgendes VBA Script:

Code:
Sub PingSystem()
'----First clear the cells in Row B-----------------
ClearStatusCells
'---------------------------------------------------
Dim strcomputer As String
Application.ScreenUpdating = True
For introw = 2 To ActiveSheet.Cells(65536, 1).End(xlUp).Row
strcomputer = ActiveSheet.Cells(introw, 1).Value
'------------Call ping function and post the output in the adjacent cell-------
If Ping(strcomputer) = True Then
strpingtest = "Online"
ActiveSheet.Cells(introw, 2).Value = strpingtest
Else
ActiveSheet.Cells(introw, 2).Font.Color = RGB(200, 0, 0)
ActiveSheet.Cells(introw, 2).Value = "Offline"
End If
Next
MsgBox "Script Completed"
End Sub

Function Ping(strcomputer)
Dim objshell, boolcode
Set objshell = CreateObject("wscript.shell")
boolcode = objshell.Run("ping -n 1 -w 1000 " & strcomputer, 0, True)
If boolcode = 0 Then
Ping = True
Else
Ping = False
End If
End Function

Sub ClearStatusCells()
Range("B2:B1000").Clear
End Sub


Frage: 
An welcher stelle kann ich Quelle und Ziel der bestimmten? 
Bis jetzt ist es so in Feld A die IP eingegeben wird und in Feld B das Ergebnis angezeigt wird. 
Bis jetzt habe konnte ich nur erkennen wo Feld B gelöscht wird.

Weiß jemand Rat?

Gruß Guido
Hallo,

hier wird doch in Spalte B alles gelöscht:

Code:
Sub ClearStatusCells()

Range("B2:B1000").Clear

End Sub

Wenn Du jedoch eine andere Stelle suchst, dann gehe den Script doch schrittweise mi F8 durch, bis Du die Stelle hast, wo gelöscht wird.
Hi

mit den 1en und 2en überall in Cells()

ActiveSheet.Cells(introw, 1)
Zeile = introw    , Spalte = 1 (also A))

Gruß Elex
Danke, das wars 


.... Besten DANK für deine Hilfe