|
-
Jul 7th, 2009, 05:02 AM
#1
Thread Starter
Lively Member
[RESOLVED] Disable worksheet scrolling
Hello All..
It's been a while (bet you thought you got rid of me?)... I have just realized that Ctrl-PgUp and Ctrl-PgDown scrolls through the worksheets of an Excel project. I would like to disable this feature, possibly in my Workbook open code? Does anyone know how I would do this?
Thanks in advance......
-
Jul 7th, 2009, 07:30 AM
#2
Re: Disable worksheet scrolling
you could try using application.onkey to set those keys to do nothing
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jul 7th, 2009, 08:24 AM
#3
Re: Disable worksheet scrolling
With or without code? Cause it is possible both ways...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Jul 11th, 2009, 02:56 PM
#4
Thread Starter
Lively Member
Re: Disable worksheet scrolling
Hello Koolsid,
I'm not sure how to answer that...What I want is to enter a code in the "Workbook_Open()" of "This Workbook" so, I guess I want it with a code?
Hope that makes sense......
-
Jul 11th, 2009, 02:57 PM
#5
Thread Starter
Lively Member
Re: Disable worksheet scrolling
Hello WestConn1,
I would try that but I'm afraid of disabling those keys as I need the page up-and down for other applications in this project...
-
Jul 11th, 2009, 11:26 PM
#6
Re: Disable worksheet scrolling
you can specify if only with ctrl
or pass the key actions with other workbooks
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jul 13th, 2009, 08:43 AM
#7
Re: Disable worksheet scrolling
 Originally Posted by NPD071
Hello Koolsid,
I'm not sure how to answer that...What I want is to enter a code in the "Workbook_Open()" of "This Workbook" so, I guess I want it with a code?
Hope that makes sense......
Yes it does 
I'll share a little trick with you 
On my screen I can see 43 row approx. If you want to see only 25 rows then change 43 to 25. After you run the code, you will see that Page down doesn't work....
Logic: I use "freeze pane" and then hide rest of the rows so that page down doesn't have any effect....
vb Code:
Private Sub Workbook_Open()
'~~> Change Row 43 to the row that you want
Rows("43:43").Select
'~~> Freeze Pane
ActiveWindow.FreezePanes = True
'~~> Hide rest of the row below Row 43
Rows("43:43").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.EntireRow.Hidden = True
End Sub
Hope this helps...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Jul 16th, 2009, 04:19 PM
#8
Thread Starter
Lively Member
Re: Disable worksheet scrolling
Thanks Koolsid...that works great!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|