Excel code refinement