View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Andyjim Andyjim is offline
external usenet poster
 
Posts: 70
Default variable doesn't reference correct column

Hi Rick-

Thanks so much. I know I don't understand variables well enough. I tried
to apply your suggestion.. Could you tell me where I am going wrong?

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