Disabling Ctrl-PgUp and Ctrl-PgDn

G

Guest

I know how to remove the sheet tabs at Tools, Options, then uncheck Sheet
tabs. But that does not disable the ability to change sheets with Ctrl-PgUp
and Ctrl-PgDn. Is there a way to disable that function in Excel?

Thank you
 
R

R Avery

Disable it by assigning it to something else.


private sub thisworkbook_open()
application.onkey "^{PGUP}","DummyMacro"
application.onkey "^{PGDN}","DummyMacro"
end sub

public sub DummyMacro

end sub
 
G

Guest

Hi,
I guess you are trying to do that for a specific workbook.
You could hide the other sheets:
- select the sheet to be hidden
- menu Format > Sheet > Hide
And similar to unhide which means the user can still go in menu Format >
Sheet and see that some sheets are hidden.

To prevent the user from seeing the sheets in that menu, in the vba editor,
run the following code to hide a sheet, eg here hides Sheet2:
Worksheets("sheet2").visible = xlSheetVeryHidden
Now the user cannot unhidde it from Excel. For you to unhide the sheet, do:
Worksheets("sheet2").visible = xlSheetVisible

I hope this helps,
Sebastien
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top