Hi!
Worked a bit over the weekend and got something that does what I need.
Thank you Boller for helping me look at the problem from a different angle =) What I have ended up with is (Suggestions for improvement welcome):
Option Explicit
Dim FL As Integer
Dim FF As Integer
Dim FindString As String
Dim wb As Workbook
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim StartRng As Range
Dim EndRng As Range
Dim Rng As Range
Dim LastRow As Long
Dim i As Long
Dim NamedRng As String
Sub Klar()
Set wb = ActiveWorkbook
Set ws1 = Worksheets("Blad1")
Set ws2 = Worksheets("Blad2")
Set StartRng = ws2.Range("A1")
Set EndRng = ws1.Range("A1")
Application.ScreenUpdating = False
With ws1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
ws1.Range("A2:A" & LastRow).Copy
Application.Goto StartRng
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End With
With ws2
ws2.Range("A:A").RemoveDuplicates Columns:=1, Header:=xlNo
Application.CutCopyMode = False
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
Application.Goto StartRng
For i = 1 To LastRow
FindString = ActiveCell.Value
With ws1.Range("A:A")
Set Rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
FF = ActiveCell.Row
Set Rng = .Find(What:=FindString, _
After:=.Cells(1), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False)
Application.Goto Rng, True
FL = ActiveCell.Row
NamedRng = "TR_" & ActiveCell.Value
wb.Names.Add Name:=NamedRng, _
RefersToR1C1:="=R" & FF & "C" & 2 & ":INDEX(C" & 3 & "," & FL & ")"
Application.Goto Reference:=NamedRng
'With Selection.Interior
'.Pattern = xlSolid
'.PatternColorIndex = xlAutomatic
'.ThemeColor = xlThemeColorDark1
'.TintAndShade = -0.249977111117893
'.PatternTintAndShade = 0
'End With
Else
MsgBox ("TR. " & ActiveCell.Value & " hittades inte!")
ActiveCell.Interior.Color = 49407
End If
End With
Application.Goto StartRng.Offset(i, 0)
Next i
End With
Application.ScreenUpdating = True
Application.Goto EndRng
End Sub