J
Johnny
Hi all, this is a snippet of VBA code that I recorded and added some
"lastrow" information into (line numbers added for the sake of my
question):
1 Dim lastrow As Integer
2 lastrow = Cells(Rows.Count, 1).End(xlUp).Row
3 Worksheets("Working Folder").Range("A1:" & "S" & lastrow).Select
4 ActiveWorkbook.Worksheets("Working Folder").Sort.SortFields.Clear
5 ActiveWorkbook.Worksheets("Working Folder").Sort.SortFields.Add
Key:=Range( _
""N:" & "N" & lastrow"), SortOn:=xlSortOnValues,
Order:=xlAscending, DataOption:= _
xlSortNormal
6 With ActiveWorkbook.Worksheets("Working Folder").Sort
7 .SetRange Range("A1:" & "S" & lastrow)
8 .Header = xlYes
9 .MatchCase = False
10 .Orientation = xlTopToBottom
11 .SortMethod = xlPinYin
12 .Apply
13 End With
I'm getting the compiler error: expected: list separator or ")". It is
failing in the section: ""N:" & "N" & lastrow
What I'm trying to accomplish is select A1 down to S(lastrow) and sort
by column N1:N(Lastrow). Hopefully I'm just missing a parenthesis or
another set of quotes? Thanks for assistance.
"lastrow" information into (line numbers added for the sake of my
question):
1 Dim lastrow As Integer
2 lastrow = Cells(Rows.Count, 1).End(xlUp).Row
3 Worksheets("Working Folder").Range("A1:" & "S" & lastrow).Select
4 ActiveWorkbook.Worksheets("Working Folder").Sort.SortFields.Clear
5 ActiveWorkbook.Worksheets("Working Folder").Sort.SortFields.Add
Key:=Range( _
""N:" & "N" & lastrow"), SortOn:=xlSortOnValues,
Order:=xlAscending, DataOption:= _
xlSortNormal
6 With ActiveWorkbook.Worksheets("Working Folder").Sort
7 .SetRange Range("A1:" & "S" & lastrow)
8 .Header = xlYes
9 .MatchCase = False
10 .Orientation = xlTopToBottom
11 .SortMethod = xlPinYin
12 .Apply
13 End With
I'm getting the compiler error: expected: list separator or ")". It is
failing in the section: ""N:" & "N" & lastrow
What I'm trying to accomplish is select A1 down to S(lastrow) and sort
by column N1:N(Lastrow). Hopefully I'm just missing a parenthesis or
another set of quotes? Thanks for assistance.