Private Sub Worksheet_Change(ByVal Target As Range)
Dim UndoString As String
Dim SelectionRow As Long
Dim EndDragColumnLetter As String, StartDragColumnLetter As String
Dim TargetAddressArray As Variant
If Target.CountLarge < 2 Then Exit Sub
If Application.WorksheetFunction.CountA(Target) = 0 Then Exit Sub
SelectionRow = Selection.Row
TargetAddressArray = Split(Selection.Address(0, 0), ":")
EndDragColumnLetter = Evaluate(Replace("=LEFT(""X"",MIN(FIND({0,1,2,3,4,5,6,7,8,9}" & _
",ASC(""X"")&1234567890))-1)", "X", TargetAddressArray(1)))
StartDragColumnLetter = Evaluate(Replace("=LEFT(""X"",MIN(FIND({0,1,2,3,4,5,6,7,8,9}" & _
",ASC(""X"")&1234567890))-1)", "X", TargetAddressArray(0)))
If Not Intersect(Target, Range("E3:E42")) Is Nothing And Target.CountLarge > 1 Or _
Not Intersect(Target, Range("F3:F42")) Is Nothing And Target.CountLarge > 1 Or _
Not Intersect(Target, Range("G3:G42")) Is Nothing And Target.CountLarge > 1 Then
With Application
.EnableEvents = False
If .CommandBars("Standard").Controls("&Undo").List(1) = "Paste" And _
.CutCopyMode = xlCopy Then
.Undo
Target.PasteSpecial Paste:=xlPasteValues
.CutCopyMode = False
.EnableEvents = True
Exit Sub
End If
.Undo
If SelectionRow = ActiveCell.Row Then
Range(TargetAddressArray(0) & ":" & EndDragColumnLetter & _
ActiveCell.Row).AutoFill Destination:=Range(TargetAddressArray(0) & _
":" & TargetAddressArray(1)), Type:=xlFillValues
Else
Range(StartDragColumnLetter & ActiveCell.Row & ":" & EndDragColumnLetter & _
ActiveCell.Row).AutoFill Destination:=Range(TargetAddressArray(1) & _
":" & TargetAddressArray(0)), Type:=xlFillValues
End If
.EnableEvents = True
End With
End If
End Sub