[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Ping list of computers in excel and return result

Posted on 2012-04-10
Medium Priority
Last Modified: 2013-12-06

I have a large excel spreadsheet which contains a list of computer names and IP Addresses

Is there a way to have excel Ping each computer name and then return a result of "Online" or "offline" in a new column next to each computer name, depending on the result of the ping?

Otherwise i have to do this manually


Question by:Wolf
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 14

Expert Comment

ID: 37827774
See if this EE answered problem is what you need: ping all computer from sheet list...
LVL 26

Accepted Solution

redmondb earned 2000 total points
ID: 37829177
Hi, Andrew.

Please see attached. Macro is...
Sub Ping_Check()
' Based on http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/e59a38e1-eaf0-4b13-af10-fd4be559f50f/
Dim oPing As Object
Dim oRetStatus As Object
Dim xCell As Range
Dim xLast_Row As Long
Dim xWork1 As String
Dim xWork2 As String

xLast_Row = ActiveSheet.Range("A1").SpecialCells(xlLastCell).Row

Application.ScreenUpdating = False
    For Each xCell In Range("A2:A" & xLast_Row)
        If xCell = "" Then
            xCell.Offset(0, 1) = ""
            Set oPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_PingStatus where address = '" & xCell & "'")
            For Each oRetStatus In oPing
                If IsNull(oRetStatus.StatusCode) Or oRetStatus.StatusCode <> 0 Then
                    xCell.Offset(0, 1) = "N/A"
                    '11001   Buffer Too Small
                    '11002   Destination Net Unreachable
                    '11003   Destination Host Unreachable
                    '11004   Destination Protocol Unreachable
                    '11005   Destination Port Unreachable
                    '11006   No Resources
                    '11007   Bad Option
                    '11008   Hardware Error
                    '11009   Packet Too Big
                    '11010   Request Timed Out
                    '11011   Bad Request
                    '11012   Bad Route
                    '11013   TimeToLive Expired Transit
                    '11014   TimeToLive Expired Reassembly
                    '11015   Parameter Problem
                    '11016   Source Quench
                    '11017   Option Too Big
                    '11018   Bad Destination
                    '11032   Negotiating IPSEC
                    '11050   General Failure
                    xCell.Offset(0, 1) = oRetStatus.ResponseTime & " ms ; " & oRetStatus.ResponseTimeToLive
                End If
        End If
Application.ScreenUpdating = True

End Sub

Open in new window


Author Closing Comment

ID: 37841620
Perfect, thanks
LVL 26

Expert Comment

ID: 37841769
Thanks Andrew.

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question