Writing a data conversion app that concatenates groups of two digit state codes and is written in ECXEL vba. I redd the data into an array and output what I need to an output array Rout, and when done write the result to a worksheet. There is one column that I would like to sort immediately after the concatenation and remove duplicates in that string. Here is that portion of the code:
RinCol = 1
RoutRow = 1
RoutCol = 0
For RinRow = 2 To LastRow - 2
'If same, concatenate States and Record IDs
If Rin(RinRow, RinCol) = (Rout(RoutRow, RoutCol)) Then
Rout(RoutRow, 5) = Rout(RoutRow, 5) & "," & Rin(RinRow, 6)
'Sort Rout Here
'Remove Rout duplicates here
Rout(RoutRow, 6) = Rout(RoutRow, 6) & "," & Rin(RinRow, 0)
Else
'Move next company to Rout
Rout(RoutRow + 1, 0) = Rin(RinRow, 1)
Rout(RoutRow + 1, 1) = Rin(RinRow, 2)
Rout(RoutRow + 1, 2) = Rin(RinRow, 3)
Rout(RoutRow + 1, 3) = Rin(RinRow, 4)
Rout(RoutRow + 1, 4) = Rin(RinRow, 5)
Rout(RoutRow + 1, 5) = Rin(RinRow, 6)
Rout(RoutRow + 1, 6) = Rin(RinRow, 0)
RoutRow = RoutRow + 1
End If
String looks like FL,MO,TX,AZ,CA,CO,ID,IL,KS,MO,NE,NV,NM,OH,OR,TX,UT,WA
So I need two functions, one to sort the string and the next to remove duplicates. I want to do it in place in memory, if I can. I have looked at different solutions on the web, but they seem to be overKill for what I want. Not great at veba just OK.
Using office 10 on windows 7.
Thanks in advance
jpl
RinCol = 1
RoutRow = 1
RoutCol = 0
For RinRow = 2 To LastRow - 2
'If same, concatenate States and Record IDs
If Rin(RinRow, RinCol) = (Rout(RoutRow, RoutCol)) Then
Rout(RoutRow, 5) = Rout(RoutRow, 5) & "," & Rin(RinRow, 6)
'Sort Rout Here
'Remove Rout duplicates here
Rout(RoutRow, 6) = Rout(RoutRow, 6) & "," & Rin(RinRow, 0)
Else
'Move next company to Rout
Rout(RoutRow + 1, 0) = Rin(RinRow, 1)
Rout(RoutRow + 1, 1) = Rin(RinRow, 2)
Rout(RoutRow + 1, 2) = Rin(RinRow, 3)
Rout(RoutRow + 1, 3) = Rin(RinRow, 4)
Rout(RoutRow + 1, 4) = Rin(RinRow, 5)
Rout(RoutRow + 1, 5) = Rin(RinRow, 6)
Rout(RoutRow + 1, 6) = Rin(RinRow, 0)
RoutRow = RoutRow + 1
End If
String looks like FL,MO,TX,AZ,CA,CO,ID,IL,KS,MO,NE,NV,NM,OH,OR,TX,UT,WA
So I need two functions, one to sort the string and the next to remove duplicates. I want to do it in place in memory, if I can. I have looked at different solutions on the web, but they seem to be overKill for what I want. Not great at veba just OK.
Using office 10 on windows 7.
Thanks in advance
jpl