Hi everyone,
I'm trying to loop through all the cell in column B in sheet 2 to see if they match the key in the dictionary. If it does, then it should copy the row to sheet 1.
This is what I currently have. I literally just started studying VBA last week. Sorry for the bad coding =p
Dim symboldic As New Scripting.dictionary
Dim adv As Long
adv = Sheets("Results").Cells(3, 3).value
Dim beta As Long
beta = Sheets("Results").Cells(4, 3).value
Dim klrow As Integer
klrow = Sheets("Group Positions ADV BETA").Range("K65536").End(xlUp).row
Dim i As Integer
Dim symbol As String
For i = 2 To klrow
symbol = Sheets("Group Positions ADV BETA").Cells(i, 11).value
If Sheets("Group Positions ADV BETA").Cells(i, 12) < adv Or Sheets("Group Positions ADV BETA").Cells(i, 13) > beta Then
On Error Resume Next
symboldic.Add symbol, Nothing
End If
Next i
Dim j As Integer
Dim resultlrow As Integer
Dim result As String
Dim blastrow As Range
Set blastrow = Sheets("Results").Range("B65536").End(xlUp)
resultlrow = Sheets("Account Positions").Range("B" & Rows.Count).End(xlUp).row
For j = 2 To resultlrow
result = Sheets("Account Positions").Cells(j, 2).value
If symboldic.Exists(result) = True Then
Sheets("Results").Range("B" & blastrow, "E" & blastrow).value = Sheets("Account Positions").Range(Cells(j, 1), Cells(j, 4).value)
End If
Next j
End Sub
I'm trying to loop through all the cell in column B in sheet 2 to see if they match the key in the dictionary. If it does, then it should copy the row to sheet 1.
This is what I currently have. I literally just started studying VBA last week. Sorry for the bad coding =p
Dim symboldic As New Scripting.dictionary
Dim adv As Long
adv = Sheets("Results").Cells(3, 3).value
Dim beta As Long
beta = Sheets("Results").Cells(4, 3).value
Dim klrow As Integer
klrow = Sheets("Group Positions ADV BETA").Range("K65536").End(xlUp).row
Dim i As Integer
Dim symbol As String
For i = 2 To klrow
symbol = Sheets("Group Positions ADV BETA").Cells(i, 11).value
If Sheets("Group Positions ADV BETA").Cells(i, 12) < adv Or Sheets("Group Positions ADV BETA").Cells(i, 13) > beta Then
On Error Resume Next
symboldic.Add symbol, Nothing
End If
Next i
Dim j As Integer
Dim resultlrow As Integer
Dim result As String
Dim blastrow As Range
Set blastrow = Sheets("Results").Range("B65536").End(xlUp)
resultlrow = Sheets("Account Positions").Range("B" & Rows.Count).End(xlUp).row
For j = 2 To resultlrow
result = Sheets("Account Positions").Cells(j, 2).value
If symboldic.Exists(result) = True Then
Sheets("Results").Range("B" & blastrow, "E" & blastrow).value = Sheets("Account Positions").Range(Cells(j, 1), Cells(j, 4).value)
End If
Next j
End Sub