I am getting run time error 6: Overflow through the below code.
n = (.Cells(Rows.Count, "A").End(xlUp).Row)
FillP = Array("D", "E", "F", "H", "I", "J", "M", "O", "P", "AR", "AS", "BE", "BF", "BG", "BH", "BI", "BJ", "BK", "BL", "BQ", "BR", "BS", "BT", "BU", "BV", "BW", "BX", "BY", "CB", "CC", "CD")
'fill blanks with na
For i = 2 To n
For j = LBound(FillP) To UBound(FillP)
If Trim(.Range(FillP(j) & i)) = "" Then
.Range(FillP(j) & i) = "na"
End If
Next j
Next i
I have Excel 2010, I haven't yet declared any of the above variables yet (will do after testing). Just trying to fill blanks in specific columns with an "na". Nearly identical code appears earlier in my sub and yet it runs fine. No idea where i'm going wrong.
Thanks in advance for any help!
IF Not IsError(.Range(FillP(j) & i)) ThenVariantwill silently promote itself to aLonginstead of overflowing as anInteger. In fact, it will silently promote itself to aDoubleinstead of overflowing as aLong.