I am very new to VB so please help me to loop through the array of
locations to get unique locations from the data table.  I know it
seems strange but the data table contains the locations listed
multiple times. When I add the location to the location report I only
need the location listed once.


Thanks for your help in advance.

Here is my code so far:
Private Sub GetLocationData_Click()

' counts the number of items in the data sheet
Dim i As Integer
Dim row As Integer
Dim count As Integer
Dim loc() As String
Dim row2 As Integer
Dim row3 As Integer



row = 2

For i = 0 To count
    Do While Sheets("Data").Cells(row, 4) <> ""

    row = row + 1
    Loop
    count = row - 1
Next

ReDim Preserve loc(count) 'preserves the upperbound of the array



Dim stores() As String
Dim stCount As Integer
Dim uniquecnt As Integer
Dim match As Boolean
Dim strOne As String
Dim strTwo As String

 row2 = 2
 row3 = 5

 ' Assigns value to each element in the array
For Each Location In loc
    store = Sheets("Data").Cells(row2, 4)
  row2 = row2 + 1
Next Location

ReDim Preserve loc(count)

ReDim stores(0)


 For stCount = LBound(loc()) To UBound(loc())
    match = False

    For uniquecnt = LBound(stores()) To UBound(stores())

            If stores(uniquecnt) = loc(stCount) Then
            match = True
            End If
    Next uniquecnt

            If Not match Then
            stores(uniquecnt) = loc(stCount)
            ReDim Preserve stores(uniquecnt)
            End If

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to dotnetdevelopment@googlegroups.com
To unsubscribe from this group, send email to
dotnetdevelopment+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to