dnraitzyk
09-13-2017, 07:13 PM
Hello all,
I am new here and I am not exactly a coder. I am trying to make a simple macro that will sort a workbook that I download almost daily and sort the data by the criteria in each column. I cannot post the actual data here for privacy reasons. Basically, I would like to sort a column that has >50 values to 16 specific values all of which are very long phrases of words. An example would be like sorting this column:
Header
aaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaaa
bbbbbbbbbbb bbbbbbbbbb bbbbbbbbbbbb
cccccccccc cccccccccccccccc cccccccccccccc
dddddddddd dddddddddddddd ddddddddddddd
eeeeeeeeeeeeee eeeeeeeeeee eeeeeeeeeeeeee
Obviously there are more rows in my actual data, but let's say in this example I would just want to show the "c" and "e" row. I tried using autofilter commands like so. Keep in mind I am not a coder and all of this I have adapted from online. I would like the simplest solution possible.
Last2 = Cells(Rows.Count, 7).End(xlUp).Row
Selection.AutoFilter
Range("G5").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.AutoFilter
ActiveSheet.Range("$G$5:G" & Last2).AutoFilter Field:=1, Criteria1:=Array("aaaaaaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaa" _
, "bbbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbbbbbb" _
, "cccccccccccc cccccccc ccccccccccccccccccccccc" _
, "dddddddddddddddddddd dddddddddddddddd ddddddddddddddddd" _
, "eeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeee"), Operator:=xlFilterValues
What am I doing wrong? Any help would be greatly appreciated.
I am new here and I am not exactly a coder. I am trying to make a simple macro that will sort a workbook that I download almost daily and sort the data by the criteria in each column. I cannot post the actual data here for privacy reasons. Basically, I would like to sort a column that has >50 values to 16 specific values all of which are very long phrases of words. An example would be like sorting this column:
Header
aaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaaa
bbbbbbbbbbb bbbbbbbbbb bbbbbbbbbbbb
cccccccccc cccccccccccccccc cccccccccccccc
dddddddddd dddddddddddddd ddddddddddddd
eeeeeeeeeeeeee eeeeeeeeeee eeeeeeeeeeeeee
Obviously there are more rows in my actual data, but let's say in this example I would just want to show the "c" and "e" row. I tried using autofilter commands like so. Keep in mind I am not a coder and all of this I have adapted from online. I would like the simplest solution possible.
Last2 = Cells(Rows.Count, 7).End(xlUp).Row
Selection.AutoFilter
Range("G5").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.AutoFilter
ActiveSheet.Range("$G$5:G" & Last2).AutoFilter Field:=1, Criteria1:=Array("aaaaaaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaa" _
, "bbbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbbbbbb" _
, "cccccccccccc cccccccc ccccccccccccccccccccccc" _
, "dddddddddddddddddddd dddddddddddddddd ddddddddddddddddd" _
, "eeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeee"), Operator:=xlFilterValues
What am I doing wrong? Any help would be greatly appreciated.