ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can I prevent users selecting multiple cells? (https://www.excelbanter.com/excel-programming/281752-can-i-prevent-users-selecting-multiple-cells.html)

Angus Comber[_2_]

Can I prevent users selecting multiple cells?
 
Hello

If a user ttempts to select multiple cells or clicks on the top left to
select all rows I want to just select the top left cell in the selection -
overriding Excels usual behaviour. Can I do this? Please let me know how?

Angus Comber





Harald Staff

Can I prevent users selecting multiple cells?
 
Hi Angus

A macro can do everything. So assuming macros are enabled, running, healthy, well written
and adored. Rightclick the sheet tab, choose "View code", paste this in:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Target(1).Select
End Sub

.... but it is not a nice thing to do. Nothing "overriding" is.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"Angus Comber" wrote in message
...
Hello

If a user ttempts to select multiple cells or clicks on the top left to
select all rows I want to just select the top left cell in the selection -
overriding Excels usual behaviour. Can I do this? Please let me know how?

Angus Comber







Chip Pearson

Can I prevent users selecting multiple cells?
 
Just to keep the macro code "healthy, well-written, and adored", you might
want to disable events in the macro. E.g.,

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
Target(1).Select
Application.EnableEvents = True
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Harald Staff" wrote in message
...
Hi Angus

A macro can do everything. So assuming macros are enabled, running,

healthy, well written
and adored. Rightclick the sheet tab, choose "View code", paste this in:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Target(1).Select
End Sub

... but it is not a nice thing to do. Nothing "overriding" is.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"Angus Comber" wrote in message
...
Hello

If a user ttempts to select multiple cells or clicks on the top left to
select all rows I want to just select the top left cell in the

selection -
overriding Excels usual behaviour. Can I do this? Please let me know

how?

Angus Comber









Harald Staff

Can I prevent users selecting multiple cells?
 
"Chip Pearson" skrev i melding
...
Just to keep the macro code "healthy, well-written, and adored", you

might
want to disable events in the macro.


Ok, I want that :-)



mcpheat

Can I prevent users selecting multiple cells?
 
Try menu
tools/options/
and uncheck "row and column headers" under the view tab

Tony.


Angus Comber wrote in message
...
Hello

If a user ttempts to select multiple cells or clicks on the top left to
select all rows I want to just select the top left cell in the selection -
overriding Excels usual behaviour. Can I do this? Please let me know

how?

Angus Comber








All times are GMT +1. The time now is 07:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com