tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,913
- Office Version
- 365
- 2019
- Platform
- Windows
On my worksheet, in column A, I have 5 rows of data and a heading in cell A1.
Say:
This is my code without using classes:
With a class, this is Class1:
This is a standard module:
What I can't work out is what should go in the ?????
Thanks
Say:
Code:
Name
a
a
b
c
d
This is my code without using classes:
Code:
Option Explicit
Sub NoClass()
Dim MyArray(1 To 6, 1 To 1) As Variant
Dim i As Integer
For i = 2 To 5
If MyArray(i, 1) <> MyArray(i + 1, 1) Then ' Do something
Next i
End Sub
With a class, this is Class1:
Code:
Option Explicit
Private pName As String
Public Property Get Name() As Variant
Name = pName
End Property
Public Property Let Name(ByVal N As Variant)
pName = N
End Property
This is a standard module:
Code:
Sub WithClass()
Dim MyArray(1 To 6, 1 To 1) As Variant
Dim i As Integer
Dim MyClass As Class1
For i = 2 To 5
Set MyClass = New Class1
MyClass.Name = MyArray(i, 1)
if MyClass.Name <> ??????
If MyArray(i, 1) <> MyArray(i + 1, 1) Then
Next i
End Sub
What I can't work out is what should go in the ?????
Thanks
Last edited: