Controlling Panes in MS XL
Posted on 2014-03-11
I have two buttons on an excel worksheet. They both perform the same macro; the only difference is where the cursor ends up at the end of the macro. If button A is pressed, cell(5,3) is selected at the end of the macro; if button B is pressed, cell(56,3) is selected. The two buttons can be viewed simultaneously in separate panes. When they are so viewed, I would like the final selected cell to be displayed in the same pane that held the button that was pressed – for example, if button B is pressed in the lower pane, I would like the final selected cell for button B (i.e. cell(56,3)) to be shown in the lower pane; with the upper pane unchanged. What seems to happen is that if I press the button in the upper pane, the final selected cell is displayed in the upper pane, and the lower pane scrolls to that final selected cell as well. If I press the button in the lower pane, the final selected cell is displayed in the lower pane and the upper pane remains as it was. This is true no matter which button is displayed in which pane. Can someone show me how to control this situation in VBA so that only the pane containing the pressed button is scrolled? thanks.