Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear experts,
is there a way I can disable the cell drag and drop only for a certain range meeting my requirements? I am now using "Application.CellDragAndDrop = False" which disables the application for every cell... which is quite annoying for my users. Many thanks in advance, best regards, -- Valeria |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can code it in worksheet selection_change event procedure.
Find out if the selected range (Target) is within your range for which you want dragdrop to be disabled, with Intersect method. If it intersects set CellDragAnd Drop to False, else Set it to True e.g.: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim myRange As Range Set myRange = Worksheets("Sheet1").Range("A5:E10") 'In above statement set your range for which you want no drag drop If Application.Intersect(Target, myRange) Is Nothing Then Application.CellDragAndDrop = True Else Application.CellDragAndDrop = False End If End Sub "Valeria" wrote in message ... Dear experts, is there a way I can disable the cell drag and drop only for a certain range meeting my requirements? I am now using "Application.CellDragAndDrop = False" which disables the application for every cell... which is quite annoying for my users. Many thanks in advance, best regards, -- Valeria |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
it works very well, thank you! Best regards, Valeria "Sharad Naik" wrote: You can code it in worksheet selection_change event procedure. Find out if the selected range (Target) is within your range for which you want dragdrop to be disabled, with Intersect method. If it intersects set CellDragAnd Drop to False, else Set it to True e.g.: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim myRange As Range Set myRange = Worksheets("Sheet1").Range("A5:E10") 'In above statement set your range for which you want no drag drop If Application.Intersect(Target, myRange) Is Nothing Then Application.CellDragAndDrop = True Else Application.CellDragAndDrop = False End If End Sub "Valeria" wrote in message ... Dear experts, is there a way I can disable the cell drag and drop only for a certain range meeting my requirements? I am now using "Application.CellDragAndDrop = False" which disables the application for every cell... which is quite annoying for my users. Many thanks in advance, best regards, -- Valeria |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how can I disable "cutting cells" and "drag and drop "in excel ? | Excel Worksheet Functions | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
When I drag and drop overwrites my notes, Options ''Alert beforeoverwriting cell" | Excel Discussion (Misc queries) | |||
Disable drag and drop for a selected range under a certain conditi | Excel Programming | |||
Identify when a user attempts to turn on "Allow cell drag and drop" | Excel Programming |