How to create a macro that inserts a formula in Excel that selects another cell?

I’m working in Excel and I want to insert a formula, so I’ve created a macro that types “=” and then I want it to go left (to select the cell in the left), so I simulate a left arrow. This works. The problem is that then I want to divide by 2, so I add a “/” keystroke, but then the left cell gets de-selected. Is there a workaround?

Ok, I think I found a solution: to select the left cell programatically: =OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,-1)/2

1 Like