The Dutchman
Board Regular
- Joined
- Apr 10, 2008
- Messages
- 72
I used a macro to come up with this code which doesn't work. The code is...
I get a "Select method of range class failed" error message. Do I have to list the worksheet related to the range?
Thx
Code:
Private Sub Worksheet_Deactivate()
[COLOR=red][B][U]Range("staff1").Select
[/U][/B][/COLOR] ActiveWorkbook.Worksheets("Set Up").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Set Up").Sort.SortFields.Add Key:=Range("staff1") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Set Up").Sort
.SetRange Range("I5:I14")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
I get a "Select method of range class failed" error message. Do I have to list the worksheet related to the range?
Thx
Last edited: