View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Schwimms Schwimms is offline
external usenet poster
 
Posts: 58
Default Copy / Paste Not working with Target.value

Hi All!

I have a spreadsheet which records data entered into a "Main" tab onto an
"Updates" tab. In the code behind for the "Main" tab I am grabbing the data
with:

Case 3
valueChanged = Target.Value

The valueChanged then shows up on the "Updates" tab, code included below. My
problem occurs when I copy and paste into multiple cells it doesn't recognize
a change in the cell value I'm pasting into. Any ideas how to correct this?

Here is an example code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim dbTable As String
Dim dbCol As String
Dim keyRecord As Variant
Dim valueChanged As Variant
Dim x As Integer
Dim strDup As String
If Target.Row 2 And Cells(Target.Row, 70).Value < "" And Sheets("Mobility
2010 Build List").Range("F1").Value = "YES" Then
Select Case Target.Column
Case 1
valueChanged = Target.Value
End Select

x = 3

Do Until Sheets("Updates").Cells(x, 1).Value = ""
If dbCol = Sheets("Updates").Cells(x, 3).Value And keyRecord =
Sheets("Updates").Cells(x, 2).Value Then
strDup = "Y"
GoTo Duplicate
End If
x = x + 1
Loop
strDup = ""
'Jump point for above do until loop to exit loop if duplicate entry detected.
Duplicate:

Sheets("Updates").Cells(x, 4).Value = valueChanged
If strDup = "Y" Then
Sheets("Updates").Cells(x, 5).Value = ""
End If
End If
End Sub