View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Routine to restore drag from- and drop to- areas/cells?

That's by design, because a Drag/Drop is really a Cut followed by a Paste.
So you get ;
_SelectionChange, _Change (Cut), _Change (Paste)

A Ctrl+Drag/Drop does not have the _Change (Cut) as you are performing a
Copy/Paste

Follow the _SelectionChange and _Change events for a various combinations of
Cut, Copy, Paste, Drag/Drop to see the sequence.

NickHK

"tskogstrom" wrote in message
ps.com...
Hi nick,

I noticed WS_Change event run twice and have tried to work that away -
now I read you initial message more close, and you mention drag and
drop exactly do that. Do you know if there is there is a reason to
this?

It doesn't have any connection to WS_SelectionChange somehow?

Kind regards
tskogstrom


NickHK wrote:
As long as it is not a Copy drag/drop (CTRL+Drag/Drop), you can get the

drag
range and drop range to do what you want.
If it is Copy drag/drop, then you only get the drop range as the drag

range,
although you can follow the initial range in the _SelectionChange event.

NickHK

"tskogstrom" wrote in message
oups.com...
Thanks Nick,
I will check this. I don't need to actually know if there is a drag

and
drop, just to be sure both the "drag from areas/ranges/cells" to the
drop to target will be restored with my routine. I need to make a

Union
with drag from- and drag to- range and send it as rngCl variable like
below:


Sub Restore_FormatSheetCollection(rngCl As Range)
Dim ar As Range
Dim rn As Range
With rngCl

For Each ar In .Areas
'ar.Merge True ' the True arg merges each row
ar.FormatConditions.Delete

'RANGES
For Each rn In ar
If rn.MergeCells Then
rn.MergeArea.UnMerge
End If

' ALL CELLS
With rn.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 37
End With
.
.
etc ...

/tskogstrom