It's been a while since I have palyed with so please have grace and mercy on me. I am working on a macro and contained in that macro is a way to add departments to a list. When the userform populates, it pulls the departments to a combo box. Before this is done, I have a simple sort run so that the departments are in alphabetical order. I have done this many times before, however this time, unless I am viewing the actual sheet that the data is contained, "Departments", I get run-time error 1004 stating "The sort reference is not valid. Make sure that it is within the data you want to sort, and the first Sort By box isn't the same or blank."
Here is the data that I am using, in Ranges A2 to last on "Departments":
Building Grounds
Fellowship Hall
Lower Parking Lot
Main Worship Center
Sunday School Area
Upper Parking Lot
Youth Area
Here is the sort code:
With Sheets("Departments")
last = .Range("A65536").End(xlUp).Row
.Range("A" & 2, "A" & last).Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
btw, everything has changed a bunch since my last time here. Are there no "code" buttons anymore?
Here is the data that I am using, in Ranges A2 to last on "Departments":
Building Grounds
Fellowship Hall
Lower Parking Lot
Main Worship Center
Sunday School Area
Upper Parking Lot
Youth Area
Here is the sort code:
With Sheets("Departments")
last = .Range("A65536").End(xlUp).Row
.Range("A" & 2, "A" & last).Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
btw, everything has changed a bunch since my last time here. Are there no "code" buttons anymore?