Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I disable "cutting cells" and "drag and drop "in excel ? mwoody Excel Worksheet Functions 4 August 25th 08 03:53 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
When I drag and drop overwrites my notes, Options ''Alert beforeoverwriting cell" lbbss Excel Discussion (Misc queries) 0 February 4th 08 02:11 AM
Disable drag and drop for a selected range under a certain conditi Valeria Excel Programming 0 December 27th 04 09:19 AM
Identify when a user attempts to turn on "Allow cell drag and drop" Alan Excel Programming 9 November 21st 04 09:09 PM


All times are GMT +1. The time now is 04:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"