Hello. I am receiving an error (Run-time Error 1004) when I run the code that follows. I think it is first having an issue with the Match line. Also, I do not like using R1C1 at the bottom, but I recorded a macro initially to figure out how to do that, and that is what showed up. Thanks for any help.


Sub Titles()
        
    Dim sCountry As String
    Dim iCountryCount As Integer
    Dim rCountries As Range
    Dim iStartList As Integer
    Dim iTotalCities As Integer
    Dim iNumCountries As Integer
    
    Set rCountries = ThisWorkbook.Names("CountryList").RefersToRange
    iNumCountries = rCountries.Cells.Count
    
    For iCountryCount = 1 To iNumCountries
   
        sCountry = Worksheets("CountryData").Cells(iCountryCount + 1, 1).Value
        iStartList = WorksheetFunction.Match(sCountry, Sheets("CityMapping").Range("A1:A1000"), 0)
        iTotalCities = WorksheetFunction.CountIf(Sheets("CityMapping").Range("A1:A1000"), sCountry)
                
                
        sCountry = Replace(sCountry, " ", "")
               
        ThisWorkbook.Names.Add Name:=(sCountry & "Cities"), RefersToR1C1:= _
        "=CityMapping!R[-iStartList+8]C[-9]:R[-iTotalCities + 8 + iStartList]C[-9]"
        
    
    Next iCountryCount
    
        
End Sub