I have a loop which is dynamic ranging anywhere from one to 200. I am able to capture the values, sum them, etc but I dont know how to capture text feilds to later be be used in Msg Box . Below is code -I put the text feild location in Bold for each loop. What I would like is for each text feild in loop to be listed in mesage box. Any Suggestions?
Code:
Sub processTrade()
If CheckTrade(Range("TradeSummaryAnaylsis[Trade Target]")) = False Then
MsgBox "No Trades"
Exit Sub
End If
Dim symTrade As Range
Dim sumOfTrade As Double, curTrade As Double
Dim countOfTrade As Integer
Dim minTrade As Double, maxTrade As Double
Dim reason As String, message As String
sumOfTrade = 0
countOfTrade = 0
minTrade = 999999#
maxTrade = 0
minSym = 0
maxSym = 0
For Each symTrade In Range("TradeSummaryAnaylsis[Trade Target]")
If symTrade.Value <> "" Then
curTrade = symTrade.Offset(, 3).Value
countOfTrade = countOfTrade + 1
sumOfTrade = sumOfTrade + curTrade
If curTrade <> 0 Then
'capture the reason for low or high sales
reason = InputBox("Reason for Trade:", symTrade.Offset(, -4).Value)
symbolTraded = symTrade.Offset(, -4).Value
symTrade.Offset(, 33).Value = reason
symbolTraded = symTrade.Offset(, -4).Value
End If
End If
Next symTrade
If countOfTrade > 0 Then
message = "Made a Total of " & countOfTrade & " Trades Today" & vbCrLf
message = message & "Portfolio Changed By " & Format(sumOfTrade, "#,#.00 %") & vbCrLf
MsgBox message, vbInformation + vbOKOnly, "Daily Trade Status - " & Format(Now, "dddd, mmmm d, yyyy")
End If
End Sub
Last edited by a moderator: