splitting up an IP address

E

eluehmann

basically I am splitting up the IP so I can convert it into th
hexadecial equivalent which is used as the Win NT Host ID. I actuall
was able to figure out a way to do this and not use any VB code.
will say it is horribly complicated though. I am actually using tha
VB code elsewhere as well. If anyone wants the sheet with the formula
to convert an IP to its hexadecimal equilavlent without VB code I ca
send. Thank you everyone for the help! All answers truely helped m
learn just a little more about excel (and that is the point of thi
forum!)

-Eri
 
R

Ron Rosenfeld

basically I am splitting up the IP so I can convert it into the
hexadecial equivalent which is used as the Win NT Host ID. I actually
was able to figure out a way to do this and not use any VB code. I
will say it is horribly complicated though. I am actually using that
VB code elsewhere as well. If anyone wants the sheet with the formulas
to convert an IP to its hexadecimal equilavlent without VB code I can
send. Thank you everyone for the help! All answers truely helped me
learn just a little more about excel (and that is the point of this
forum!)

I agree -- a worksheet function would be pretty complicated.

But here is some VBA code that should do the same thing:

=============================
Function IP2Hex(IP As String) As String
Dim j As Integer
Dim Temp

Temp = Split(IP, ".")
For j = 0 To 3
IP2Hex = IP2Hex & Right("0" & Hex(Temp(j)), 2)
Next j

End Function
==================


--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top