On a Mac OS, I'm trying to figure out how I can get the IP address of a website like 'www.google.com' and add it into a cell in Excel. I've written a Visual Basic Macro script that loops through every row of a spreadsheet and takes the value of column 2 (the website URL). My spreadsheet looks like this:
|----------|-------------------|--------------|
| [Button] | Website           | IP Addresses |
|----------|-------------------|--------------|
|          | www.gov.uk        | <ip_address> |
|          | www.parliament.uk | <ip_address> |
|----------|-------------------|--------------|
I would like to put the corresponding IP Adress of the website URLs in column 2 into column 3. I've tried to write a couple of examples but I get a few errors:
Example 1
Shows an alert that says "Runtime error '424': Object required".
Sub GetIPAddresses()
    For i = 2 To Rows.Count
        If IsEmpty(Cells(i, 2).Value) = False Then
            Cells(i, 3).Value = System.Net.Dns.GetIpAddress(Cells(i, 2).Value)
        End If
    Next i
End Sub
Example 2
Shows an alert that says "Compile error: Sub or Function not defined".
Sub GetIPAddresses()
    For i = 2 To Rows.Count
        If IsEmpty(Cells(i, 2).Value) = False Then
            Cells(i, 3).Value = GetIpAddress(Cells(i, 2).Value)
        End If
    Next i
End Sub
 
    