Hi,
I believe this is a relatively simple task yet it is evading me. I am attempting to populate two columns within a listbox from two different arrays.
Below is my code:
I am able to populate the first column, although the first row is blank for some reason, and I do not believe the issue is with my array. I am just not certain how I can populate the second column?
Any suggestions would be greatly appreciated.
I believe this is a relatively simple task yet it is evading me. I am attempting to populate two columns within a listbox from two different arrays.
Below is my code:
Code:
'Capture named ranges into arrays.
arrHeaderNew = Names("headerNew").RefersToRange.Value
arrHeaderOld = Names("headerOld").RefersToRange.Value
'Check arrays against each other and capture any errors.
Dim i As Integer
For i = 1 To headerNewCount
If LCase(arrHeaderNew(1, i)) <> LCase(arrHeaderOld(1, i)) Then
ReDim Preserve arrHeaderNewError(i)
ReDim Preserve arrHeaderOldError(i)
arrHeaderNewError(i) = arrHeaderNew(1, i)
arrHeaderOldError(i) = arrHeaderOld(1, i)
End If
Next i
'Populate listbox in frmNonMatchingHeaders with fields not matching.
With frmNonMatchingHeaders
.lboxNonMatchingHeaders.List = arrHeaderNewError
'.lboxNonMatchingHeaders.List = arrHeaderOldError
.Show
End With
End Sub
I am able to populate the first column, although the first row is blank for some reason, and I do not believe the issue is with my array. I am just not certain how I can populate the second column?
Any suggestions would be greatly appreciated.