ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Excel Marco for IP Address (https://www.excelbanter.com/excel-worksheet-functions/105609-excel-marco-ip-address.html)

[email protected]

Excel Marco for IP Address
 
I have a list of servers in column A, some of the server names are IP
addresses. I need a macro that will determine if the server name
listed is an IP address and if so, do a specfic action.

Example Spreadsheet
A
1 10.2.5.99
2 10.2.5.33
3 34Bob
4 Geroge
5 Luke

Psuedo Code
Check value of column A, Cell X
If value = IP address
copy entire row to other worksheet
delete row
End If


Bob Phillips

Excel Marco for IP Address
 

Sub Test()
Dim iLastRow As Long
Dim i As Long

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
If Len(Cells(i, "A").Value) - (Len(Replace(Cells(i, "A").Value, ".",
""))) = 3 Then
If IsNumeric(Replace(Cells(i, "A").Value, ".", "")) Then
'do something"
End If
End If
Next i


End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ps.com...
I have a list of servers in column A, some of the server names are IP
addresses. I need a macro that will determine if the server name
listed is an IP address and if so, do a specfic action.

Example Spreadsheet
A
1 10.2.5.99
2 10.2.5.33
3 34Bob
4 Geroge
5 Luke

Psuedo Code
Check value of column A, Cell X
If value = IP address
copy entire row to other worksheet
delete row
End If





All times are GMT +1. The time now is 06:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com