IP Addresses in excel VBA

I'm trying to create a class in Excel VBA for IP Addresses.
I've got the absolute basics as i've never needed classes before.
Using help from CPearson's website http://www.cpearson.com/excel/classes.aspx
I've put together the class basics attached.
IPaddress.Point1 to Point4

What i'm now trying to do is "add" to an IP address.
i.e. + =

But i'm struggling.
Is there any classes out there?
is there any other suggestions on how i can handle this?
Option Explicit

Private pPoint1 As Byte
Private pPoint2 As Byte
Private pPoint3 As Byte
Private pPoint4 As Byte

'Point 1'
Public Property Get Point1() As Byte
Point1 = pPoint1
End Property
Public Property Let Point1(Value As Byte)
pPoint1 = Value
End Property

'Point 2'
Public Property Get Point2() As Byte
Point2 = pPoint2
End Property
Public Property Let Point2(Value As Byte)
pPoint2 = Value
End Property

'Point 3'
Public Property Get Point3() As Byte
Point3 = pPoint3
End Property
Public Property Let Point3(Value As Byte)
pPoint3 = Value
End Property

'Point 4'
Public Property Get Point4() As Byte
Point4 = pPoint4
End Property
Public Property Let Point4(Value As Byte)
pPoint4 = Value
End Property

'To String
Public Property Get ToString() As String
ToString = pPoint1 & "." & pPoint2 & "." & pPoint3 & "." & pPoint4
End Property

'Convert String to IP
Public Property Let StrToIP(Value As String)
Dim str() As String
str = Split(Value, ".")
If UBound(str) = 3 And LBound(str) = 0 Then
  pPoint1 = str(0)
  pPoint2 = str(1)
  pPoint3 = str(2)
  pPoint4 = str(3)
  pPoint1 = 0
  pPoint2 = 0
  pPoint3 = 0
  pPoint4 = 0
End If
End Property

Open in new window

LVL 10
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Could it be something like this? :

If ((pPoint4a+pPoint4b)\256)>1 Then
 pPoint4c=(pPoint4a+pPoint4b) mod 256


If ((pPoint3a+pPoint3b)\256)>1 Then
 pPoint3c=pPoint3c+((pPoint3a+pPoint3b) mod 256)

Still needs to continue for pPoint2 and pPoint1, but I think the main idea is there.
//  "\"means the integer part from division
// Mod means the reminder
zorvek (Kevin Jones)ConsultantCommented:
When creating classes, one should always consider what object the class represents and how that class will support the handling of that object. In this case it looks like you are not using the class as an object but more as a function. If so, then a couple of functions would probably be more appropriate and easier to create and maintain.

Is there any reason why you can't use two functions?

GetStringFromPoints(P1 As Byte, P2 As Byte, P3 As Byte, P4 As Byte) As String
GetPointsFromString(IPAddress As String) As Variant

bromy2004Author Commented:
I've solved my problem from another approach,
I'll be deleting this question.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

bromy2004Author Commented:
I normally would but i completely skipped the class.
I ended up looking from 1 to 255 Step LevelStep
and various other bits and pieces.
zorvek (Kevin Jones)ConsultantCommented:
That's OK. That is still a solution to the question "How can I do this with a class". The answer is "you really don't need a class." I'm also curious to see how you solved it.

bromy2004Author Commented:
Attached is the main part of the macro i ended up with
'Loop through point 1
'i.e. to
For L0 = Point1Min To Point1Max

  'Loop through Point 2
  'i.e. to
  For L1 = Point2Min To Point2Max
    ws.Cells(i, j).Value = Join(Array(L0, L1, 0, 0), ".")
    j = j + 1
    i = i + 1
      For L2 = 0 To 255 Step L2Step
        ws.Cells(i, j).Value = Join(Array(L0, L1, L2, 0), ".")
        j = j + 1
        i = i + 1
        For L3 = L2 To L2 + L2Step - L3Step Step L3Step
          ws.Cells(i, j).Value = Join(Array(L0, L1, L3, 0), ".")
          j = j + 1
          i = i + 1
            For L4 = L3 To L3 + L3Step - L4Step Step L4Step
              ws.Cells(i, j).Value = Join(Array(L0, L1, L4, 0), ".")
              Application.StatusBar = Join(Array(L0, L1, L4, 0), ".")
              i = i + 1
            Next L4
          j = j - 1
        Next L3
        j = j - 1
      Next L2
    j = j - 1
  Next L1
Next L0

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.