Excel VBA unique ID generator
<p>I am trying to generate unique IDs for topics of discussion. The data will be like so:</p>

<pre><code>Status    ID        Topic    Commentary
Open      FIL-1     FILM      
Open      FIL-2     FILM
Closed    LAN-1     LANG.
Open      LAN-2     LANG.
</code></pre>

<p>The idea is that when on a new row regardless of whether it was added above or below of the last unique ID I use VBA to find the next ID. So for example above if I were to add another row at the top with the topic LANG. then it would find that LAN-2 is the lastest ID and +1 to it to become LAN-3.</p>

<p>I got this working when the topics were all the same with the code below (topics were all "FIL" but now there are multiple topics):</p>

<pre><code>Private Function getNextID() As String

Dim row As Integer
Dim currentID As Integer

currentID = 0

' Loop round rows
For row = MIN_ROW To MAX_ROW

    ' Only use rows which are not blank
    If Worksheets(DISCUSS).cells(row, ID).Value &lt;&gt; "" Then
        If Mid$(Worksheets(DISCUSS).cells(row, ID).Value, InStr(3, Worksheets(DISCUSS).cells(row, ID).Value, "-") + 1) &gt; currentID Then
           currentID = Mid$(Worksheets(DISCUSS).cells(row, ID).Value, InStr(3, Worksheets(DISCUSS).cells(row, ID).Value, "-") + 1)
        End If
    End If

Next row

getNextID = "FIL" &amp; "-" &amp; currentID + 1

End Function
</code></pre>

<p>Does anyone know how I can set an array with the topic abbreviations used in the ID and use the code i've already written to loop through the same process using the abbreviations in the array to get the next ID for the specific topic being added? </p>