Maniac3575
asked on
Excel - Returning Focus after calling a macro
I have a simple macro (a sort table routine) that is called upon any change on the spreadshett. However once the macro is called, focus is transferred to those cells, and I would like to return focus to the cell that was amended. Any ideas ?
Regards,
Andy
The routine for checking the change is as follows:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
table
End Sub
And the sort is as follows:
Sub table()
Range("Q3:V9").Select
Selection.Sort Key1:=Range("V4"), Order1:=xlDescending, Key2:=Range("U4") _
, Order2:=xlDescending, Key3:=Range("S4"), Order3:=xlDescending, Header _
:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom , _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal
End Sub
Regards,
Andy
The routine for checking the change is as follows:
Private Sub Workbook_SheetChange(ByVal
table
End Sub
And the sort is as follows:
Sub table()
Range("Q3:V9").Select
Selection.Sort Key1:=Range("V4"), Order1:=xlDescending, Key2:=Range("U4") _
, Order2:=xlDescending, Key3:=Range("S4"), Order3:=xlDescending, Header _
:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
DataOption1:=xlSortNormal,
xlSortNormal
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you're welcome, didn't know for sure if the sort would trigger the event....thanks for the points
ASKER
call table
target.activate
End Sub
Works for me, many thanks