I have written some VBA code to populate cells in a worksheet. The annoying thing is , is that sometimes it works and sometimes it doesn't for absolutely no reason other than closing down the sheet and opening it again. Here is my code. I get the runtime error 1004
Dim m As String
Dim a As String
Dim n As Variant
n = Array("W", "X", "Y", "Z", "AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH", "AI", "AJ", "AK", "AL", "AM", "AN", "AO", "AP", "AQ", "AR", "AS", "AT", "AU", "AV", "AW", "AX", "AY", "AZ", "BA", "BB", "BC", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BK", "BL", "BM", "BN", "BO", "BP", "BQ", "BR", "BS", "BT", "BU", "BV", "BW", "BX", "BY", "BZ", "CA", "CB", "CC", "CD", "CE", "CF", "CG", "CH", "CI", "CJ", "CK", "CL", "CM", "CN", "CO", "CP", "CQ", "CR")
Dim i As Integer
Dim j As Integer
Dim adwes As String
For j = 4 To 100
For i = 0 To 19
adwes = n(i) + CStr(j)
s = "A" + CStr(j)
m = "='X:\Computing 2018-2019\PLCs\2019 - 2021\KS3\Year 7\[" & Range(s).Value & ".xlsx]USC'!$C" & i
Range(adwes) = m
Next i
Next j