The end function in VBA is used to End the code execution. The execution of the code immediately ends, and the control leaves the program.