How can I prevent the user from scrolling around the worksheet

You can either hide the unused rows and columns or use a VBA instruction to set the scroll area for the worksheet. The following instruction, for example, sets the scroll area on Sheetl so that the user cannot activate any cells outside of B2:D50:

Worksheets("Sheet1").ScrollArea = "B2:D50"

To set scrolling back to normal, use a statement like this:

Worksheets("Sheet1").ScrollArea = ""

Keep in mind that the ScrollArea setting is not saved with the workbook. Therefore, you need to execute the ScrollArea assignment instruction whenever the workbook is opened. This instruction can go in the Workbook_Open event handler procedure.

0 0

Post a comment