VBA coding format changes automatically

71 Views Asked by At

I am trying to use VBA in Excel. It was working fine then I started to have the following issue:

When I type the code it would reformat automatically causing the code to be formatted incorrectly, here's a simple example.

I type: Range("a2")

Before I have a chance to put the period at the end the VBE adds a space between Range and the first bracket: Range ("a2")

So then what happens is that when I type the period the cursor has remained in the same position so it is entered inside the last bracket: Range ("a2".)

I delete the period place the cursor outside the bracket and add .Select and the VBE then automatically takes the space out between range and the first bracket and now it's correctly formatted as Range("a2").Select

When I'm typing Range it stays in black but when I type the first ( the text then turns red. Whenever I type the text changes to black but then turns immediately red when I stop typing.

I've rebooted my machine. I've turned the auto syntax option on and off. To be on the latest versions I upgraded my MacOS to Sonoma from Monterey and reinstalled Excel but I'm still having the same issue.

I'm expecting to be able to type Range("a2").Select without the VBE putting the . inside the last bracket which I then have to delete and re-enter outside the bracket and complete the rest of the line of code.

This is a simple piece of code but the formatting issue makes writing more complex code practically impossible.

This is making VBA in Excel unusable... please help...

0

There are 0 best solutions below