Code:
Do While ia < 16383 'limited to how many columns are available to be populated
ActiveCell.Offset(0, 1).Select 'shift cell to seach
If ActiveCell.Value = SN Then
ia = ia + 1 'counter for columns
Do While ib < 13 'more than 1 instance
ActiveCell.Offset(0, 1).Select 'shift cell to seach
If ActiveCell.Value = SN Then
ib = ib + 1 'counter for columns
GoTo Jump1 'exit do loop querry satisfied
Else
ib = ib + 1 'keep count if not repeated immediately
If ib > 10 Then
ib = 0 'no other instance, return to 0
GoTo Jump1 'exit do loop querry satisfied
End If
End If
Loop
Jump1:
curr_set = ia + ib 'defines column count from 'A'
GoTo Jump2 'exit do loop querry satisfied
Else
ia = ia + 1 'counter for columns
End If
Loop
'^ Locating SN, checks if 2 matched SN's, uses last found
Above is the code I am currently utilizing and it does work. My issue is, this is only good to find 2 instances and there are times it could go upto 7 instances, how do I assist myselft to get the whole range reviewed and determine the LAST found file?
Later in this VB code I select the whole column this 'SN' appears in (single or 2nd match) and paste to another workbook.
Thanks for any support!