Hi there,

I have the following code written in my worksheet SelectionChange procedure

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
    Set CurrentRange = Target
    
    
    If Target.Column >= 2 And Target.Column <= 14 Then
        
        SortMe.Left = Target.Left
        SortMe.Top = 0
        SortMe.Width = Range(Split(Target.Address(False, False), ":")(0) & "1").Width + 1.5
        
        If Target.EntireColumn.Address = Target.Address Then
            SortMe.Height = Range(Split(Target.Address(False, False), ":")(0) & "1").Height + 1.5
            SortMe.Caption = "Sort"
        Else
            SortMe.Height = Range(Split(Target.Address(False, False), ":")(0)).Offset(1 - Target.Row).Height + 1.5
            SortMe.Caption = Range(Split(Target.Address(False, False), ":")(0)).Offset(1 - Target.Row).Value
        End If
        
        SortMe.Enabled = True
        SortMe.Visible = True
        
    Else
        
        SortMe.Visible = False
        SortMe.Enabled = False
        SortMe.Caption = "Sort"
        
    End If
        
End Sub
"SortMe" is an ActiveX Command Button.

All my code runs fine except for one problem: I cannot do a copy/cut & paste on the worksheet with this code. It seems like every time a selection change was triggered, the CutCopyMode (aka clipboard) gets cleared.


Does anyone have any idea what I'm doing wrong here?