Step one: don't.
I tried to get it to vibe code me a macro in Excel. I didn't think it was that complicated. It confidently gave me code. I ran it. Error. Gave it the error. It said "oh that makes sense, here's how you fix it." Um, couldn't we have just opened with that? Fine, copy, paste. Run. Error. Gave it the error. It said "oh that makes sense, here's how you fix it" and then gave me obviously incomplete code. I asked for the code in a .txt file. It gave me a Word document and the code was... not good. It didn't even LOOK like it was gonna work. I asked it how I was to copy that to Excel and it admitted I wouldn't be able to. It basically wasted my time apologetically.
Note that if I had just told Copilot to do what I want, it absolutely woulda done it. I told it I wanted what it could do in a macro so I could repeat it without going through Copilot. That was what it could not do.
"Is God so strong that He could make a boulder that He could not lift?" Similar situation.
I wasn't even trying to push Copilot too hard.
I wanted it to:
One. Analyse one column, which had FIRSTNAME LASTNAME and change it to LASTNAME, FIRSTNAME.
Two. Take a 12-digit number and apply BOLD formatting to the last four digits
Three. Couple other similar functions.
It choked.
So again... Don't.
Also, can you change how the agent behaves? Our Copilot used to have this option. I'm thinking you're not gonna heed my warning. So try this. If you have the option to customise your agent, tell it to think deeply about each step. Tell it that its goal is to produce efficient code and that you do not expect it to be nice to you. Straight up tell it to be honest and frank with you. Tell it to not lie to you. Plus deep thought, minus sycophancy. Best of luck with your project.
Edit: Formatting. Lemmy's markdown interpreter might have been coded with Copilot.