Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>Option Compare Text Sub search_and_append() Dim i As Long Dim width As Long Dim ws As Worksheet Dim telList As Object Dim count As Long Dim numList As Object Set telList = CreateObject("Scripting.Dictionary") Set numList = CreateObject("Scripting.Dictionary") ' search for all tel/number list on other sheets ' Assuming header means Row 1 For Each ws In Worksheets If ws.Name &lt;&gt; Me.Name Then With ws .Activate width = .Cells(1, .Columns.count).End(xlToLeft).Column For i = 1 To width If Trim(.Cells(1, i).Value) = "Tel" Then Height = .Cells(.Rows.count, i).End(xlUp).Row If Height &gt; 1 Then For j = 2 To Height If Not telList.exists(.Cells(j, i).Value) Then telList.Add .Cells(j, i).Value, "" End If Next j End If End If If Trim(.Cells(1, i).Value) = "Number" Then Height = .Cells(.Rows.count, i).End(xlUp).Row If Height &gt; 1 Then For j = 2 To Height If Not numList.exists(.Cells(j, i).Value) Then numList.Add .Cells(j, i).Value, "" End If Next j End If End If Next End With End If Next ' paste the tel/number list found back to this sheet With Me .Activate width = .Cells(1, .Columns.count).End(xlToLeft).Column For i = 1 To width If Trim(.Cells(1, i).Value) = "Tel" Then Height = .Cells(.Rows.count, i).End(xlUp).Row count = 0 For Each tel In telList count = count + 1 .Cells(Height + count, i).Value = tel Next End If If Trim(.Cells(1, i).Value) = "Number" Then Height = .Cells(.Rows.count, i).End(xlUp).Row count = 0 For Each tel In telList count = count + 1 .Cells(Height + count, i).Value = tel Next End If Next End With End Sub </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload