![]() |
disable cell "drag and drop" for a cell/range meeting given condit
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 |
disable cell "drag and drop" for a cell/range meeting given condit
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 |
disable cell "drag and drop" for a cell/range meeting given co
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 |
All times are GMT +1. The time now is 10:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com