larrythestag
New Member
- Joined
- Jul 30, 2009
- Messages
- 5
Hello All,
In the below VBA I use the Worksheet_Change event to startup. Everything works great until someone copies and paste using the right click. The issue is if someone Copies the value A13 and Pastes it in range (A13:A30). It seems to lock up if you use [right click > paste]. However, If you use (Ctrl + V) or any other method of copy and paste it works fine.
I am hoping someone can lend a hand on this one.
Thanks
Larry
In the below VBA I use the Worksheet_Change event to startup. Everything works great until someone copies and paste using the right click. The issue is if someone Copies the value A13 and Pastes it in range (A13:A30). It seems to lock up if you use [right click > paste]. However, If you use (Ctrl + V) or any other method of copy and paste it works fine.
I am hoping someone can lend a hand on this one.
Thanks
Larry
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Dim rng As Range
Dim test As String
Dim TopRow_Selection As Long
Dim BottomRow_Selection As Long
Dim TopLeftCel_Selection As String, BottomLeftCel_Selection As String, TopRightCel_Selection As String, BottomRightCel_Selection As String
Col = Target.Column
ro = Target.Row
With Selection
TopRow_Selection = .Row
BottomRow_Selection = .Rows.Count + .Row - 1
If TopRow_Selection <> BottomRow_Selection Then
Application.EnableEvents = False
End If
For x = TopRow_Selection To BottomRow_Selection
If Target(1, 1).Column = 1 Then
ThisRow = x
Range("A" & x).Select
Select Case Range("A" & x).Value
Case "Select"
Range("B" & ThisRow & ":K" & ThisRow).Select
'Range("B13:I13").Select
Selection.Interior.Pattern = xlSolid
Range("A" & ThisRow).Select
Case "Add New"
Range("B" & ThisRow & ":K" & ThisRow).Select
'Range("B13:I13").Select
Selection.Interior.Pattern = xlSolid
Range("H" & ThisRow).Interior.Pattern = xlCrissCross
Range("A" & ThisRow).Select
Case "Job/Function Change"
Range("B" & ThisRow & ":K" & ThisRow).Select
Selection.Interior.Pattern = xlSolid
Range("D" & ThisRow & ":J" & ThisRow).Select
'Range("D13:I13").Select
Selection.Interior.Pattern = xlCrissCross
Range("A" & ThisRow).Select
Case "Leaving Department"
Range("B" & ThisRow & ":K" & ThisRow).Select
Selection.Interior.Pattern = xlSolid
Range("D" & ThisRow & ":K" & ThisRow).Select
'Range("D13:I13").Select
Selection.Interior.Pattern = xlCrissCross
Range("A" & ThisRow).Select
Case "Termination"
Range("B" & ThisRow & ":K" & ThisRow).Select
Selection.Interior.Pattern = xlSolid
Range("D" & ThisRow & ":K" & ThisRow).Select
'Range("D13:I13").Select
Selection.Interior.Pattern = xlCrissCross
Range("A" & ThisRow).Select
Case "Transfer (Manager Change)"
Range("B" & ThisRow & ":K" & ThisRow).Select
Selection.Interior.Pattern = xlSolid
Range("D" & ThisRow & ":G" & ThisRow).Select
'Range("D13:G13").Select
Selection.Interior.Pattern = xlCrissCross
Range("J" & ThisRow & ":K" & ThisRow).Select
'Range("D13:G13").Select
Selection.Interior.Pattern = xlCrissCross
Range("A" & ThisRow).Select
'Case "Name Change"
' Range("B" & ThisRow & ":I" & ThisRow).Select
' Selection.Interior.Pattern = xlSolid
' Range("A" & ThisRow).Select
End Select
Else: End If
Next
End With
Application.EnableEvents = True
End Sub