Maybe. If it is a seven speed block on an eight speed hub (and a spacer or two) then it is a straight swap. If it is eight of a nine speed block on a seven speed hub then it is a straight swap.
If it is an 8 speed in place of a 7 speed then you will need an 8/9 speed hub. You can do this by either
a) getting a new wheel,
b) replacing the exisiting hub with a new one (rebuilding the wheel)
c) swapping the freehub for an 8-speed one and redishing the wheel.
bear in mind that any of the above options will probably change your OLN dimension (width of the hub) so may require either a bit of effort to fit the wheel, or bending of the frame a little (if a steel frame).
Good luck!
.d