imback2nite
Board Regular
- Joined
- Oct 30, 2004
- Messages
- 211
- Office Version
- 2003 or older
- Platform
- Windows
I'm having trouble with the Deactivate. The code works now but it keeps taking me back to the original page and not the page the user is trying to select. I'm probably doing something dumb but I can't figure it out. Thanks for any help!
Code:
Private Sub Worksheet_Deactivate()
Sheet5.Select
Sheet5.Unprotect "4wink"
Range("I1:I500").Select
Selection.Sort Key1:=Range("I2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Sheet5.Range("D1:D500").Select
Selection.Sort Key1:=Range("D2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Sheet5.Range("E2:E500").ClearContents
Sheet5.Range("E2") = "=IF(D2="""","""",COUNTIF(Galleys!$B$21:$AS$65,D2)+SUMPRODUCT((Galleys!$B$20:$AS$20=""LARGE"")*(Galleys!$B$21:$AS$65=D2)))"
Sheet5.Range("E2").Select
Selection.AutoFill Destination:=Range("E2:E" & Cells(Rows.Count, "D").End(xlUp).Row)
Sheet2.CommandButton1.Caption = ThisWorkbook.Sheets("Disciplines").Range("$A2")
Sheet2.CommandButton3.Caption = ThisWorkbook.Sheets("Disciplines").Range("$A3")
Sheet2.CommandButton4.Caption = ThisWorkbook.Sheets("Disciplines").Range("$A4")
Sheet2.CommandButton2.Caption = ThisWorkbook.Sheets("Disciplines").Range("$A5")
Sheet2.CommandButton6.Caption = ThisWorkbook.Sheets("Disciplines").Range("$A6")
Sheet2.CommandButton7.Caption = ThisWorkbook.Sheets("Disciplines").Range("$A7")
Sheet2.CommandButton11.Caption = ThisWorkbook.Sheets("Disciplines").Range("$A8")
Application.CutCopyMode = False
ActiveSheet.Protect "4wink"
Application.ScreenUpdating = True
End Sub