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:
- Vba select column by name
- Excel vba find column by header name - Best answers
- Vba select column - Best answers
- Vba select case like - Guide
- To create a network bridge you must select at least two lan ✓ - Network Forum
- Why can't i select messages on whatsapp ✓ - WhatsApp Forum
- Number to words in excel formula without vba - Guide
- Please insert the correct dvd-rom select ok and restart application nfsmw ✓ - Video Games 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