You cannot literally highlight an arbitrary section of code and run it. You
can copy a line to the Immediate Window and run it, if it makes sense. You
can leave it there and execute it again and again, if you like. You can
execute several independent statements at a time, if you separate them with
colons, but they have to be on "one line" (e.g., x=9: For i = 1 to 6:
Debug.Print i + x: Next i ).
If you have paused execution, variables will retain their values in the
Immediate window and you can investigate or change their values in the
Locals window. You can change variable values while paused by executing
statements in the Immediate window also.
Look at the Debug menu. You can step into code, out of procedures, over
calls and step line by line (F8), executing each line one at a time. You can
"run to the cursor." You can set a break point and execution will stop
there, where you can resume (F5) or step (F8). You can break on a particular
variable value or if it changes value, depending on what you set in the
Watch window.
In VBA, individual procedures will run independently of other procedures, if
they do not need arguments, even if they are ordinarily part of a larger
series of calls. You can have test procedure call other procedures that
require arguments.
Bob