Target Question

J

jkrist46

Below is the Macro I have. Instead of doing a copy of entire row I wan
just certain cells in that row (A-H). What would be the best way t
accomplish this.

Private Sub Worksheet_Change(ByVal Target As Range)

****************************************************************************************
'

****************************************************************************************
' monitors any change in the worksheet. If it is confined to a singl
cell that resides
' in our target column, and has a specific value,
' it will copy the entire row to the next blank row in the targe
tab

****************************************************************************************


Dim varAnswer As String
Dim txtMessage As String

txtMessage = "Copy This!"

If Target.Count > 1 Then Exit Sub ' more than one cell?
If Target.Column <> 24 Then Exit Sub ' is this my target row?

Select Case Target.Value ' if matches a case, do the actio
required
Case "X" 'check for both upper and lower case
'confirmation step
varAnswer = MsgBox("Copy to Test Tab?", vbYesNo
txtMessage)
If varAnswer = vbNo Then
Exit Sub
End If
'cut and paste to target tab
Target.EntireRow.Cop
Worksheets("Test").Range("A65536").End(xlUp).Offset(1, 0)
Case "x" 'check for both upper and lower case
'confirmation step
varAnswer = MsgBox("Copy to Test Tab?", vbYesNo
txtMessage)
If varAnswer = vbNo Then
Exit Sub
End If
'cut and paste cut and paste to target tab
Target.EntireRow.Cop
Worksheets("Test").Range("A65536").End(xlUp).Offset(1, 0)
' future use
Case "Cancelled"
Target.EntireRow.Copy Worksheets("Cancelle
Actions").Range("A65536").End(xlUp).Offset(1, 0)
End Select
End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top