Factors to consider when swapping a battery with a power supply
There are two things that define a voltage source:

1) Voltage
2) Source resistance

Batteries have a different source resistance than a regular supply, this affects its ability to source current to whatever load\device you are using. Make sure the battery will source enough current.

The other thing is voltage, unlike a regulated voltage source, batteries are unregulated, meaning the voltage that is supplied could range from 21V to 26V (or more) from a 24V lead acid battery. If the load needs a regulated voltage, you'll need to add a voltage regulator or the load might not function correctly.

If your going the other way around, since the load expects an range of voltages of probably 5 lithium cells which would be 16-21V if you have a regulated supply with 18V that should work assuming you have more current than the battery could supply. 

Make sure you don't make the cable too high resistance or the voltage drop on the cable could be high enough to cause problems.