Search and Goto Range(Target.Address).Value in column M

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
2,040
Office Version
  1. 2019
Platform
  1. Windows
Hello ,

Is there a way to jump to the duplicate value in column M. I want Vba to jump to the first instance of the duplicate value so that If the word "Thomas" is at M5 and at M20, I'd like to be taken to the top value which is M5. By taken I mean to scroll to the cell's row. Please also note that the column M will only have one duplicate entry and more than one duplicate entry is not possible. Also kindly note that I want to scroll Row only and not the column.

Will appreciate and much thanks.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hello ,

Is there a way to jump to the duplicate value in column M. I want Vba to jump to the first instance of the duplicate value so that If the word "Thomas" is at M5 and at M20, I'd like to be taken to the top value which is M5. By taken I mean to scroll to the cell's row. Please also note that the column M will only have one duplicate entry and more than one duplicate entry is not possible. Also kindly note that I want to scroll Row only and not the column.

Will appreciate and much thanks.
Sorry about the title. as my duplicate value is also target address's value. I'm just interested in the results..
 
Upvote 0
Will the duplicate always be a specific value?
 
Upvote 0
Ok, how about
VBA Code:
Sub omairhe()
   Dim Cl As Range
   
   With CreateObject("scripting.dictionary")
      For Each Cl In Range("M2", Range("M" & Rows.Count).End(xlUp))
         If Not .Exists(Cl.Value) Then
            .Add Cl.Value, Cl
         Else
            .Item(Cl.Value).Activate
            Exit Sub
         End If
      Next
   End With
End Sub
 
Upvote 0
Solution
Ok, how about
VBA Code:
Sub omairhe()
   Dim Cl As Range
  
   With CreateObject("scripting.dictionary")
      For Each Cl In Range("M2", Range("M" & Rows.Count).End(xlUp))
         If Not .Exists(Cl.Value) Then
            .Add Cl.Value, Cl
         Else
            .Item(Cl.Value).Activate
            Exit Sub
         End If
      Next
   End With
End Sub
In Freezepanes this will also scroll the columns. But I like it and no problems.
Thank you.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
Ok, how about
VBA Code:
Sub omairhe()
   Dim Cl As Range
  
   With CreateObject("scripting.dictionary")
      For Each Cl In Range("M2", Range("M" & Rows.Count).End(xlUp))
         If Not .Exists(Cl.Value) Then
            .Add Cl.Value, Cl
         Else
            .Item(Cl.Value).Activate
            Exit Sub
         End If
      Next
   End With
End Sub

Dear Fluff, after usage in other sheet I come across a problem with the way your given code is working. For example, when there are empty cells in between. As promised only one instance of duplicate will be present in my list , however I was not considering the empty cells in between the list. Could you please make the necessary adjustment to your otherwise fabulous code please to run with empty cells in between my list of column M?

Thanks a lot.
 
Upvote 0
Try
VBA Code:
If Not .Exists(Cl.Value) And Cl.Value <> "" Then
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,433
Members
448,897
Latest member
ksjohnson1970

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top