A
Andyjim
Hi-
Can you tell me where I am wrong in regard to this code. Below I have noted
where it causes an error;
Sub MovePastTradesLoop()
'Define Variables
Dim TradesEnteredPast As Range, PastCheck As Range
With Sheets("Analysis")
Set TradesEnteredPast = Range("at17:at56")
End With
'Loop: Check for complete trades, copy to Trade History
For X = 1 To TradesEnteredPast.Count
Set PastCheck = TradesEnteredPast(X)
If PastCheck.Value = "True" Then
PastCheck.EntireRow.Select ERRORS OUT HERE
Selection.Copy
Sheets("TradeHistory").Select
Range("A4").Activate
Selection.End(xlDown).Select
ActiveCell.Offset(rowoffset:=1, columnoffset:=0).Activate
ActiveCell.EntireRow.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1").Select
Sheets("Analysis").Select
Range("A1").Select
Else
MsgBox ("OK") 'Goes with Else. Comment out
Exit Sub 'Goes with Else. Comment it out.
End If
Next 'Ends "For Each" Loop
End Sub
Can you tell me where I am wrong in regard to this code. Below I have noted
where it causes an error;
Sub MovePastTradesLoop()
'Define Variables
Dim TradesEnteredPast As Range, PastCheck As Range
With Sheets("Analysis")
Set TradesEnteredPast = Range("at17:at56")
End With
'Loop: Check for complete trades, copy to Trade History
For X = 1 To TradesEnteredPast.Count
Set PastCheck = TradesEnteredPast(X)
If PastCheck.Value = "True" Then
PastCheck.EntireRow.Select ERRORS OUT HERE
Selection.Copy
Sheets("TradeHistory").Select
Range("A4").Activate
Selection.End(xlDown).Select
ActiveCell.Offset(rowoffset:=1, columnoffset:=0).Activate
ActiveCell.EntireRow.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1").Select
Sheets("Analysis").Select
Range("A1").Select
Else
MsgBox ("OK") 'Goes with Else. Comment out
Exit Sub 'Goes with Else. Comment it out.
End If
Next 'Ends "For Each" Loop
End Sub