Hi All,

I have created a Dynamic Array "CustomerID" by using =OFFSET functions. In cell A1, I have a value, let's say "12" and I am require to find the same value in cell A1 in my Dynamic Array "CustomerID".

Any ideal how can I do?

Alternatively, I have research a code from http://www.vbforums.com/showthread.php?t=157498

It seem somewhat similar just that I need to modify it abit. However, I do not understand how this code work and hence I could not modify it to my case. I would really appreciate if someone could help me to understand this and modify.

[VBA]Public Sub bArrRemoveDuplicate(ByRef ByteArray() As Byte)
Dim LowBound As Long, UpBound As Long
Dim TempArray() As Byte, TempByte As Byte, Cur As Long
Dim A As Long, B As Long

'check for empty array
If (Not ByteArray) = True Then Exit Sub

'we need these often
LowBound = LBound(ByteArray)
UpBound = UBound(ByteArray)

'reserve check buffer
ReDim TempArray(LowBound To UpBound)

'set first item
Cur = LowBound
TempArray(Cur) = ByteArray(LowBound)

'loop through all items
For A = LowBound + 1 To UpBound
TempByte = ByteArray(A)
'make a comparison against all items
For B = LowBound To Cur
'if is a duplicate, exit array
If (TempArray(B) Xor TempByte) = 0 Then Exit For
Next B
'check if the loop was exited: add new item to check buffer if not
If B > Cur Then Cur = B: TempArray(Cur) = ByteArray(A)
Next A

'fix size
ReDim Preserve TempArray(LowBound To Cur)
'copy
ByteArray = TempArray
End Sub

[/VBA]

I would really appreciate if someone could advise me on this.

Thanks a million