End ( xlDown )

A bug found because of using End(xlDown)
Please stop using Range("A1").End(xlDown) ...

CodeFunctionName
What is this?

Public

Tested

Original Work
Do not use ...
    test_policy_array = Range([c_Test_Pol], [c_Test_Pol].End(xlDown))
Instead use ...
    test_policy_array = Range([c_Test_Pol], [c_Test_Pol].Offset(Worksheetfunction.Counta([c_Test_Pol].EntireColumn) -2))
   
    Do you see why?
   
    When [c_Test_Pol] name refers to last cell in area, or it referes to a cell that nothing below it, going down to end using xlDown will go to last cell in column, which is cell 1,024,000
    We do not want to do that, right?

Views 159

Downloads 56

CodeID
DB ID