Below is a function which will return True or False if a valid IP address is entered. A valid IP address is of the form nnn.nnn.nnn.nnn where nnn >=0 and <=255
You can put following type of construct in a cell
1. Open your workbook and ALT+F11
2. Locate your Workbook name in Project Explorer Window
3. Right click on your workbook name > Insert > Module
4. Copy paste the Macro code given
5. Delete you Macro if the Macro was needed to be run only once.
6. Otherwise save your file as .xlsm if you intend to reuse Macro again.
Function IsValidIP(Cell) As Boolean
Dim i As Long
Arr = Split(Cell, ".")
If UBound(Arr) = 3 Then
For i = LBound(Arr) To UBound(Arr)
If Not IsNumeric(Arr(i)) Or Arr(i) > 255 Then
IsValidIP = True
The workbook related to this can be downloaded from Function_Valid_ IP_Address