+ Reply to Thread
Results 1 to 9 of 9

Ping IP Address and Write Result to next Cell

  1. #1
    Forum Contributor
    Join Date
    07-21-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2010
    Posts
    117

    Ping IP Address and Write Result to next Cell

    Hello,

    I am wondering if you could help me adapt this code to my workbook example attached?

    Basically, I would like to “ping” each computer ip address to check if it is online or offline and then write the result in Column C.

    Can anyone help? There needs to be no limit to how many ip addresses the script can ping.

    Thanks in advance!

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,177

    Re: Ping IP Address and Write Result to next Cell

    Ty this out.
    Original code from: (romperstomper)
    http://www.excelforum.com/excel-prog...om-a-cell.html

    See attached.

    HTH
    Attached Files Attached Files
    Regards

    Rick
    Win10, Office 365

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Ping IP Address and Write Result to next Cell

    Hello tomlanacaster,

    This macro will return the status of ping on the IP address. It is more complete than "connected"/ "not connected". This macro code has been added to the attached workbook. Run the macro GetIPStatus. This may take some time because each address has to respond or timeout before the WMI will return to the calling macro.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,177

    Re: Ping IP Address and Write Result to next Cell

    Nice Leith, very nice.

  5. #5
    Forum Contributor
    Join Date
    07-21-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2010
    Posts
    117

    Re: Ping IP Address and Write Result to next Cell

    Absolutely superb - thanks to both!

  6. #6
    Registered User
    Join Date
    10-25-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    1

    Thumbs up Re: Ping IP Address and Write Result to next Cell

    [Solved]
    Thanks a lot Leith Ross.

    Your provided excel file worked for me out of the box.
    One more thing i want to ask you.
    can we change the background color of the to green if result is "online"
    & red color for remaining else.

    thirdly can we export this file as a daily record?

    Your help in the above subject will be much more helpful.

    Thanks again.! :-)
    Have A nice day.
    Last edited by pradeepsingh; 10-25-2012 at 12:53 AM. Reason: solved

  7. #7
    Registered User
    Join Date
    09-04-2014
    Location
    Pittsburgh, USA
    MS-Off Ver
    MS Office 2010
    Posts
    1

    Re: Ping IP Address and Write Result to next Cell

    Thanks, Leith Ross. This code worked for me in Windows 7 professional, and saved me a bunch of headaches in troubleshooting. Brilliant work.

  8. #8
    Registered User
    Join Date
    08-12-2015
    Location
    Texas
    MS-Off Ver
    Office 2013
    Posts
    2

    Re: Ping IP Address and Write Result to next Cell

    Implemented Leith's code but it returns "Connected" if the cell containing the IP address is empty.

    Is there an easy way to modify the code to validate the IP field data prior to running the PING? In other words if the cell is empty or not in x.x.x.x format then bypass the ping for that cell and move on to the next one?

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Ping IP Address and Write Result to next Cell

    RC4G welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

    Besides, this thread is essentially almost 6 years old
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1