Condensing Code

Do you want to make the code smaller or easier to read and understand ?

If the latter then put the code in a function with a sensible name and call the function when required.

An example of what you are trying to achieve would be helpful.