Sorting macro

kamal1jacq

New Member
Joined
Feb 4, 2010
Messages
12
Hi,

The below macro does not help me to sort data. Can someone help me in to sort the data through macro or correct the below coding and help me to identify what the mistake is.


Sub sorting()


' Sorting Macro



'CODING TO CHECK THE NETTING UPLOADED
MsgBox "open Netting uploaded template"
C = Application.GetOpenFilename
Set Wrk3 = Workbooks.Open(C)
Application.GoTo ActiveSheet.Range("A1"), True


Dim rStart As Range
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Set rStart = Selection
With ActiveSheet.Sort
.SortFields.Add Key:=Range("A1"), Order:=xlAscending
.Header = xlYes
.Apply
End With




End Sub
 
Last edited:

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
A bit hard to give you an answer as you don't describe what you want the sort to do, what your data looks like, whether your data is constants or what is wrong with the result you are getting so I will start by asking what the code below does...

Code:
Sub bbb()
C = Application.GetOpenFilename
Set Wrk3 = Workbooks.Open(C)
Range("A1").CurrentRegion.Sort Range("A1"), xlAscending, , , , , , xlYes
End Sub
 
Upvote 0
Thanks. I got the issue solved with the below coding

Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,301
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top