ajay_gajree
Well-known Member
- Joined
- Jul 16, 2011
- Messages
- 518
Code:
Sub CountryCorrection()
Dim rCell As Range
Dim rRng As Range
Dim dNumbers As Double
Dim strCountries As String
Dim lMatch As Long
dNumbers = Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", _
"18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", _
"33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", _
"48", "49")
strCountries = Array("Argentina", "Australia", "Botswana", "Brazil", "Canada", "China", "Egypt", _
"France", "Germany", "Ghana", "Gibraltar", "Hong Kong", "India", "Indonesia", _
"Ireland", "Israel", "Italy", "Japan", "Kenya", "Lithuania", "Malaysia", _
"Mauritius", "Mexico", "Monaco", "Mozambique", "Namibia", "Oman", "Pakistan", _
"Philippines", "Portugal", "Qatar", "Russia", "Saudi Arabia", "Seychelles", _
"Singapore", "South Africa", "South Korea", "Spain", "Switzerland", "Taiwan", _
"Tanzania", "Thailand", "UAE", "Uganda", "Ukraine", "United Kingdom", "USA", _
"Zambia", "Zimbabwe")
With Sheet1
Set rRng = ThisWorkbook.Worksheets("Deletions").Range("F1", .Cells(.Rows.Count, 3).End(xlUp))
End With
For Each rCell In rRng.Cells
lMatch = Application.WorksheetFunction.Match(rCell.Value, dNumbers, False)
rCell.Value = strCountries(lMatch)
'/rCell.Offset(0, 1).Value = vaGroups(lMatch - 1)
Next rCell
End Sub
Hi,
I am trying to change numerical values in a Table in my worksheets (Column F) using two arrays as above.
When I run the above I am getting the compile error - "Expected Array"
Can anyone with a fresh pair of eyes see what I have done wrong? Also confirm if what I have done will actually work!
Thanks a lot