I have six variable ranges: A_backup, B_backup, C_backup, D_backup, E_backup, F_backup
Each range variable is one column with a variable number of rows (some have 3, others have 5, etc.)
I would like to take each cell from these ranges and add them to a new single column array called Combined_backups. I would also like to avoid adding a cell if it is a duplicate string value to a previously added cell.
Here's what I've tried. Running into issues with the Combined_backups.RemoveDuplicates. Should I make a new range for the combined array, apply the RemoveDuplicates, then create a new final array? Also, what's the best way to test that my Combined_backups array has actually become the array I was hoping for?
Dim Combined_backups() As Variant
'add A_backup
Dim j As Integer
j = A_backup.Rows.Count
ReDim Preserve Combined_backups(j)
For i = 0 To j - 1
Combined_backups(i) = A_backup.Item(i + 1)
Next i
'add B_backup
Dim k As Integer
k = B_backup.Rows.Count
ReDim Preserve Combined_backups(j + k)
For i = 0 To k - 1
Combined_backups(i) = B_backup.Item(i + 1)
Next i
'add C_backup
Dim l As Integer
l = C_backup.Rows.Count
ReDim Preserve Combined_backups(j + k + l)
For i = 0 To l - 1
Combined_backups(i) = C_backup.Item(i + 1)
Next i
'add D_backup
Dim m As Integer
m = D_backup.Rows.Count
ReDim Preserve Combined_backups(j + k + l + m)
For i = 0 To m - 1
Combined_backups(i) = D_backup.Item(i + 1)
Next i
'add E_backup
Dim n As Integer
n = E_backup.Rows.Count
ReDim Preserve Combined_backups(j + k + l + m + n)
For i = 0 To n - 1
Combined_backups(i) = E_backup.Item(i + 1)
Next i
'add F_backup
Dim o As Integer
o = F_backup.Rows.Count
ReDim Preserve Combined_backups(j + k + l + m + n + o)
For i = 0 To o - 1
Combined_backups(i) = F_backup.Item(i + 1)
Next i
'elminate duplicates from Combined_backups
Combined_backups.RemoveDuplicates
Thanks!