Right then chaps & chapesses, I'm struggling!
Can someone tell me what i'm doing wrong here: -
Sub SORT_into_BRANCHES()
'
' SORT_into_BRANCHES Macro
'
Dim X As Range
Set X = ActiveCell
Sheets("INFO").Select
Range("AM").AutoFilter Field:=1, Criteria1:=X
Range("A9").Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("RELATIONSHIPS").Select
X.Offset(3, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("RELATIONSHIPS").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("RELATIONSHIPS").Sort.SortFields.Add Key:=Range( _
"H18"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("RELATIONSHIPS").Sort
.SetRange Range("H17:H25")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
I know its this final section where i'm trying to sort the pasted values in ascending order, but i cant get it right.
It needs to work for the actual highlighted selection that has just been pasted, then i want to go back to 'X', and offset to the next cell on the right, until there isnt a cell with a value to the right of 'X'.
Does this make sense?