Hi All,
I've a trading journal in one of the sheets. Entries are based on strategies like AT, SS, SELF etc in one of the column. Now I have separate sheets as well for AT, SS, SELF etc. End of the day I want to segregate my trades in separate sheets as per strategy. I've written the code for eg fetch the entries associated with AT in its dedicated sheet. If statement works as long as it finds AT but doesn't continue to next line if it finds anything else (other than AT). I want code to continue till last entry in the main sheet.
My code is attached below. Any help is appreciated.
Regards.
Dinesh.
I've a trading journal in one of the sheets. Entries are based on strategies like AT, SS, SELF etc in one of the column. Now I have separate sheets as well for AT, SS, SELF etc. End of the day I want to segregate my trades in separate sheets as per strategy. I've written the code for eg fetch the entries associated with AT in its dedicated sheet. If statement works as long as it finds AT but doesn't continue to next line if it finds anything else (other than AT). I want code to continue till last entry in the main sheet.
My code is attached below. Any help is appreciated.
Regards.
Dinesh.
VBA Code:
Sub CopyTradesFromAT()
Dim rng As Range
Dim row As Range
Sheets("ATPA").Activate
Range("A408").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Sheets("Trade Diary").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Set rng = Selection
For Each row In rng.Rows
If ActiveCell.Offset(0, 4).Value = " " Then Exit Sub
If ActiveCell.Offset(0, 4).Value = "AT" Then
ActiveCell.Range("A1:B1").Select
Selection.Copy
Worksheets("ATPA").Activate
ActiveCell.Activate
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
ActiveCell.Offset(0, 3).Activate
Worksheets("Trade Diary").Activate
Application.CutCopyMode = False
ActiveCell.Range("H1:J1").Select
Selection.Copy
Worksheets("ATPA").Activate
ActiveCell.Activate
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
ActiveCell.Offset(0, 3).Activate
Worksheets("Trade Diary").Activate
Application.CutCopyMode = False
ActiveCell.Offset(0, 13).Range("A1").Select
Selection.Copy
Worksheets("ATPA").Activate
ActiveCell.Activate
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
ActiveCell.Offset(1, -6).Activate
Worksheets("Trade Diary").Activate
Application.CutCopyMode = False
ActiveCell.Offset(1, -20).Range("A1").Select
End If
Next row
Worksheets("ATPA").Activate
End Sub
Last edited by a moderator: