Stepper motor and variables not working together

When I put a specific speed for the motor it would work. For Example
myStepper.setSpeed(100);,
but when I put a variable that constantly changes it doesn't work. For Example
myStepper.setSpeed(value1);