|First, a posting tip:|
You are not using the pre tags correctly. Your brackets are wrong and you didn't use a slash at the end. Click on the pre icon below "Post Reply!" and see what is placed in the text entry field. Once you have the tags in your post, paste your code between the 2 tags, like this (I added a space so the tag shows in this post)
<pre>Put your code between these 2 tags</ pre>
As for your code, you said this:
"The Macro is a recorded Macro of 'Data Sort' across columns E,F,G,H,I,J". However, your code actually sorts E:K via this instruction:
Am I missing something?
BTW...I'm pretty sure that this code does the same thing as your's, but with a lot less instructions:
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("E3"), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
As for your requirement: "What i require is to 'paste' this macro to 'O4' to then complete the function across columns O,P,Q,R,S,T, and so on across the worksheet"
I'm not quite sure what you mean by that. You don't "paste a macro" to a cell.
Are you saying that you want to sort Column O:T, in the same manner as you are sorting E:K?
When you say "and so on across the worksheet" do you mean that you have other ranges, e.g X:AD, AH:AN, etc?
If that's the case, you could simply replicate the code, changing the Key and SetRange values for each Range you want to sort, but that is kind of a brute force method.
A more elegant method would be to loop through that one block of code, updating the range values each time, assuming there is some sort of pattern, e.g. Sort 7 Columns, Skip 3, Sort 7 Columns, Skip 3, etc.
Please clarify your requirements and we'll see waht we can do to help.
Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.