Oh yes, they were useful; there is no question about that. They were for a time the decisive ship in determining who was going to control the seas, they were the most expensive man-made objects on the planet and while it doesn’t sound so impressive now lobbing shells the size of compact cars at other ships 20 miles away or so which were moving at 25kts or so and you yourself were moving 25kts or so with any degree of accuracy was an impressive feat. The shells would spend several seconds in flight during which the target ship would cover quite some distance from where it had been when the shells were fired; for its day the fire control on battleships was rather high tech.
They remained very useful in WW2, but it was clear that that aircraft carrier had dethroned them as the instrument of decision in control of the seas. Battleships weren’t just relegated to shore bombardment and as AA platforms though; Japan for example lost more battleships in surface actions than it did to air attacks in WW2:
Kongō - sunk by submarine torpedo
Hiei - left crippled by night surface action against US cruisers and destroyers and unable to clear Ironbottom Sound before morning, finished off by aircraft from Henderson Field when day broke
Kirishima - sunk in Ironbottom Sound by naval gunfire from the USS Washington
Haruna - sunk at anchor by air attack , Kure, 28 July 1945.
Fusō - sunk by destroyer torpedoes, Surigao Strait
Yamashiro - sunk by naval gunfire, Surigao Strait
Ise - sunk at anchor by air attack, Kure, 28 July 1945.
Hyūga - sunk at anchor by air attack, Kure, 28 July 1945.
Yamato - sunk by carrier aircraft
Musashi - sunk by carrier aircraft
Mutsu - lost to accidental internal magazine explosion
Nagato - survived the war, expended as a target in nuclear testing
Notably the three Japanese battleships sunk at anchor at Kure at the end of the war were in fact quite literally relegated to floating AA platforms when they were sunk and no longer considered to be battleships by the Japanese; there was not enough oil left in Japan for them to sortie: