Subckt design in SPICE
Since you're apparently asking about PSpice (based on your other question):

.subckt VARIRES 1 2 CTRL
R1 1 2 1E10
G1 1 2 Value = {V(1,2)/(V(CTRL)+1µ)}
.ENDS


This is from http://powerelectronics.com/site-files/powerelectronics.com/files/archive/powerelectronics.com/mag/503PET07.pdf

The above a 1 ohm (variable) resistor. G1 is a (controlled) current source. The (current) value it returns is based on dividing the voltage between the nodes 1 and 2 (the ends of the pot) by the value of the controlling voltage applied at node CTRL (the pot cursor/wiper). R1 (which has a huge value) is simply there to measure the voltage from 1 to 2. To actually change the current (resistor value), you need go change G1.

That frankly struck me as not the most obvious approach. The more obvious way is using two resistors:

.subckt SCHEMATIC1_R1 1 2 t
RT_R1 1 t {(1K*(1-X))+.001}
RB_R1 t 2 {(1K*X)+.001}
.ends SCHEMATIC1_R2


From https://www.ece.vt.edu/tutorials/download/Sweeping_POT.pdf

This is a 1K variable resistor and uses the X parameter (between 0 and 1) to set the position of the pot.