first when you say back and forth is it down shifting when going up the hill and upshifts after you have reached the top or is it constantly shifting while going up the hill but after you reach the top it stops? how many miles are on it? Its not uncommom for the trans to downshift out of overdrive while going up inclines to give you the extra power to make it. But if it is acting nuts when going up hill and starts shifting repeatedly i would definitly take it to the dealer to have it looked at. But I am no trans expert maybe someone will chime in later with more info for you.
by the way welcome to the site
2004 sonic blue ranger edge plus 4x2, 3.0, auto regular cab, stepside bed
Current mods: some
Future mods: to many to list
2005 dark gray metallic honda goldwing. makes up where the ranger lacks