How to change sort function to VB6?

T

Taurus

This is my sort function in VBA:

Sub mSortSheet(oWS As Object, RangeStart As String, RangeEnd As String,
SortCell As String)

oWS.Range(RangeStart & ":" & RangeEnd).Sort Key1:=Range(SortCell),
Order1:=xlAscending, Header:= _
'xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
'DataOption1:=xlSortNormal


I could i change it to VB6 using the same sort function cos i need to
create oWS as object.
Please provide syntax.
 
J

JE McGimpsey

Taurus said:
This is my sort function in VBA:

Sub mSortSheet(oWS As Object, RangeStart As String, RangeEnd As String,
SortCell As String)

oWS.Range(RangeStart & ":" & RangeEnd).Sort Key1:=Range(SortCell),
Order1:=xlAscending, Header:= _
'xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
'DataOption1:=xlSortNormal


I could i change it to VB6 using the same sort function cos i need to
create oWS as object.
Please provide syntax.

Not sure what you're asking - all versions of MacXL use VBA5, and VB6
doesn't run on Macs.

Note that by not qualifying your Key1 argument, Range(SortCell), the
default parent of Range (i.e., the ActiveSheet) will be used.
 
T

Taurus

Hello JE McGimpsey,
I change the syntax as follows for the sort function and it doesn't
sort properly. May I know is any error of the syntax below?
It does pass the correct parameter but i don't know y it doesn't sort
properly? Thank you so much if you could look into it.

Sub mSortSheet(oWS As Object, RangeStart As String, RangeEnd As String,
SortCell As String)

Call oWS.Range(RangeStart & ":" & RangeEnd).Sort(oWS.Range(SortCell),
1, , , , , , 1, 1, False, 1, , 0)

End sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top