Can I run a part of a code once then continue onto the rest

If I understand what you want it's just what setup() is for. It runs something once on startup and then when it's finished carries on to run the main loop() repeatedly.

Steve