I have two bikes trek 820 and specialized hard rock but i want to use the treks rims and tires on the specialized. the trek has a six sprocket and the other has a seven is it possible to switch the two.
can i just switch the sprockets out is all im asking?
If both are freewheels you can, but if the 7 is a freehub it won't work as their attachment to the rest of the hub looks entirely different.
If wheel size is the same you could have a go at swapping out the whole wheel, but it would depend on your shifters. If you're running indexing (fixed positions) shifters merely swapping the wheels out would leave you with a sprockets/shifter mismatch. And for 6/7 the difference in spacing is so big that I think it would be hard to get the gears to run cleanly on either bike after a swap.
If you're running friction (smooth transition) shifters you're good to go. Might need some adjustment of the limit screws on the RD though.
If the Specialized is your main bike you could consider getting a 7-spd freewheel for the trek wheel and simply use both sets of wheels on that bike.