Hello All. I am attempting to write a macro (in Excel 2010) that attempts to find one value from sheeta on sheetb. If the value is found, then I am doing an InStr search to see if a certain string from sheeta is also found in that row of sheetb. If so, then I need to label the H column of sheeta. if not then i want to findnext until all have been found and checked. I am checking muliple rows of sheeta through this loop so that is the reason the For Next is also in the macro.
I am not getting any errors with the macro, but nothing is being labeled - even though i know from previous versions of this macro (using an inefficient looping system that broke down when there was more than 20 rows to look at) that there should be some matches.
Is anyone able to tell me what the issue might be? Thank you in advance.
I am not getting any errors with the macro, but nothing is being labeled - even though i know from previous versions of this macro (using an inefficient looping system that broke down when there was more than 20 rows to look at) that there should be some matches.
Is anyone able to tell me what the issue might be? Thank you in advance.
Code:
Dim anum As Long
Dim match As String
Dim tick As String
Dim found As Range
Dim rcprime As Range
Set R2 = Intersect(sh0.Range("A:A"), sh0.UsedRange)
For rc2 = R2.count To 2 Step -1
'On Error Resume Next
sh0.Activate
If Cells(rc2, 7).Value = "(100.00)" Then
'On Error Resume Next
anum = sh0.Cells(rc2, 1).Value
tick = sh0.Cells(rc2, 10).Value
sh1.Activate
Set R1 = Intersect(sh1.Range("A:A"), sh1.UsedRange)
Set found = R1.Find(What:=anum)
If Not found Is Nothing Then
Set rcprime = found
Do
sh1.Activate
Set found = R1.FindNext(After:=found)
If Not found Is Nothing Then
If found.Address = rcprime.Address Then Exit Do
End If
match = Cells(ActiveCell.Row, 5).Value
If InStr(match, tick) > 0 Then
sh0.Activate
ActiveSheet.Cells(rc2, 8) = "RESTRICTED BY TICKER"
Else
Exit Do
End If
Loop
End If
End If
Next