Hi All,
I attempted to write something that would print out a list of values that are in an array but not in Column A, however haven't had much success. Any pointers would be greatly appreciated, thanks.
Listing Austria, Belgium, Spain in Col A; it prints out 'Belgium 3 times.
I attempted to write something that would print out a list of values that are in an array but not in Column A, however haven't had much success. Any pointers would be greatly appreciated, thanks.
Code:
Sub Listchecker()
Dim LastRow As Long
Dim Countrylist As Variant
Dim Missinglist As String
Dim Countryno As Long
Countryno = WorksheetFunction.Count(Countrylist)
Missinglist = ""
With ActiveSheet
LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
End With
Countrylist = Array("Austria", "Belgium", "Bulgaria", "Czech Republic", "Denmark", "Finland", "France", "Germany", "Hungary", "Ireland", "Italy", _
"Lithuania", "Netherlands", "Poland", "Romania", "Slovakia", "Sweden", "UK", "Croatia", "Estonia", "Greece", _
"Latvia", "Norway", "Portugal", "Slovenia", "Spain")
With Range("A1:A" & LastRow)
For i = 1 To LastRow
For j = 1 To Countryno
If Countrylist(j) = Range("A" & i) Then
Else
Missingcont = Countrylist(j)
End If
Next j
Missinglist = Missinglist & " " & Missingcont
Next i
End With
'Print list of missing
Range("B1").Value = Missinglist
End Sub
Listing Austria, Belgium, Spain in Col A; it prints out 'Belgium 3 times.