Drag and drop cell by selecting any place inside a cell

Xokiru

New Member
Joined
Nov 22, 2016
Messages
3
Hi,

I like to move cells around the sheet in my work, to do so, you have to select border of the cell, only then you can move the whole cell. My question: is it possible to enable either through settings or VBA - ability to move cells by selecting any place inside the cell, not only the corner of it?

Of course, cut and paste would be other way around, but I was wondering, since already exist drag and drop option, maybe there is such possibility? :)

Thank you!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
You can make it so a right click will cut the cell and then you could double click another cell to paste if that helps? It disables some functionality though so i'd recommend using Ctrl+X -> Ctrl+V (Cut and paste) shortcuts instead. But if you want to try it on a worksheet first then:

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
On Error GoTo ErrCapture 'avoids double click error when nothing is cut/copied
    Cancel = True
    Paste ActiveCell
End
ErrCapture:
    Cancel = False
End Sub


Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    Cancel = True
    Selection.Cut
End Sub

Make sure you post the code above in to a worksheet, not a module.
 
Last edited:
Upvote 0
Is this what you want?

Code below combines cut & paste by using right-click for cut - cell formula is pasted to next selected cell
Works for single cell only
Works once only for each cut

Test in a new sheet
right-click = cut
selecting another cell = paste

Place code below in the SHEET module (does not work if placed in Module1, Module2 etc)
Code:
Option Explicit
Dim Cut As Boolean

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    Cancel = True
    Cut = True
    Target.Cut
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Cut Then
        Application.EnableEvents = False
        Selection.Cells(1).Select
        Me.Paste
    End If
    
    Cut = False
    Application.EnableEvents = True
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,148
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top