jgravesNew
New Member
- Joined
- Jun 11, 2015
- Messages
- 6
Hi all,
I've been trying for a while to get this to work! I am looking to find "Yes" in my column D range (D24:D75). If found, move to the corresponding cell in column A, copy that value and move it into row 3 in my Target sheet. Then find next "Yes", go to column A, copy, and paste to row 4 in my Target sheet...and so on.
Any help is greatly appreciated!
Sub CopyYes()
Dim c As Range
Dim j As Integer
Dim Source As Worksheet
Dim Target As Worksheet
Set Source = ActiveWorkbook.Worksheets("Rebalance")
Set Target = ActiveWorkbook.Worksheets("SellList")
j = 3 ' Start copying to row 3 in target sheet
For Each c In Source.Range("D24:D75")
If c = "Yes" Then
Cells.Activate
With ActiveCell
ActiveCell.Offset(0, -3).Copy Destination:=Target.Rows(j)
j = j + 1
End With
End If
Next c
End Sub
I've been trying for a while to get this to work! I am looking to find "Yes" in my column D range (D24:D75). If found, move to the corresponding cell in column A, copy that value and move it into row 3 in my Target sheet. Then find next "Yes", go to column A, copy, and paste to row 4 in my Target sheet...and so on.
Any help is greatly appreciated!
Sub CopyYes()
Dim c As Range
Dim j As Integer
Dim Source As Worksheet
Dim Target As Worksheet
Set Source = ActiveWorkbook.Worksheets("Rebalance")
Set Target = ActiveWorkbook.Worksheets("SellList")
j = 3 ' Start copying to row 3 in target sheet
For Each c In Source.Range("D24:D75")
If c = "Yes" Then
Cells.Activate
With ActiveCell
ActiveCell.Offset(0, -3).Copy Destination:=Target.Rows(j)
j = j + 1
End With
End If
Next c
End Sub