+ Reply to Thread
Results 1 to 3 of 3

disable cell "drag and drop" for a cell/range meeting given condit

  1. #1
    Valeria
    Guest

    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. #2
    Sharad Naik
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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. #3
    Valeria
    Guest

    Re: 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" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1