VBA find column by name and sort
Solved/Closed
SidK
Posts
6
Registration date
Wednesday April 29, 2015
Status
Member
Last seen
October 13, 2015
-
Updated on Jan 30, 2019 at 06:27 AM
bOFILL - Apr 30, 2019 at 08:16 AM
bOFILL - Apr 30, 2019 at 08:16 AM
Related:
- Excel vba find column by header name
- Vba select column by name - Best answers
- Vba excel find column by header name - Best answers
- Vba case like - Guide
- Number to words in excel without vba - Guide
- Enable vba in excel - Guide
- Vba check if value is in array - Guide
- Vba create folder if not exist ✓ - Excel Forum
2 responses
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Jul 6, 2015 at 02:46 AM
Jul 6, 2015 at 02:46 AM
you can make it simpler. many of the arguments are default arguments for e.g. ascending order etc.
try this simpler macro
try this simpler macro
Sub sorting()
Dim col As String, cfind As Range
col = "sku"
Worksheets(1).Activate
col = "sku"
Set cfind = Cells.Find(what:=col, lookat:=xlWhole)
'Set rng1 = Range(cfind, cfind.xlDown)
ActiveSheet.Cells.Sort key1:=cfind, Header:=xlYes
End Sub
Jul 6, 2015 at 06:14 AM
Thanks so much for your help.
The code you provided works.
I have cleaned the code up slightly:
Col = "sku" was added twice
And I removed 'Set rng1 = Range(cfind, cfind.xlDown)
Thanks again!
Apr 30, 2019 at 08:16 AM