VBA find column by name and sort
Solved/Closed
SidK
Posts
6
Registration date
Wednesday 29 April 2015
Status
Member
Last seen
13 October 2015
-
3 Jul 2015 à 10:34
bOFILL - 30 Apr 2019 à 08:16
bOFILL - 30 Apr 2019 à 08:16
Related:
- Excel vba find column by header name
- Vba find column by header name - Best answers
- Vba excel find column by header name - Best answers
- Excel vba find - Guide
- Excel column number - Guide
- Vba excel mac - Guide
- Excel vba vlookup - Excel Forum
- Excel mod apk for pc - Download - Spreadsheets
2 responses
venkat1926
Posts
1863
Registration date
Sunday 14 June 2009
Status
Contributor
Last seen
7 August 2021
811
6 Jul 2015 à 02:46
6 Jul 2015 à 02:46
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
6 Jul 2015 à 06:14
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!
30 Apr 2019 à 08:16