I'm not understanding why this line of code gives me a Subscript out of Range error. I'm using the sheet CODENAME because the tab name in Excel gets changed occasionally. If I use the actual tab name in excel it doesn't give me any errors. "MA_BPT_Rng" is a named range in my workbook.
I've tried both of these lines and I get a subscript out of range error.
I've tried both of these lines and I get a subscript out of range error.
Code:
numPlans = WorksheetFunction.CountA(Sheets("WCG_Inputs").Range("MA_BPT_Rng"))
numPlans = WorksheetFunction.CountA(ThisWorkbook.Sheets("WCG_Inputs").Range("MA_BPT_Rng"))