View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default Macro not doing?

Is it running at all? If not, you may have somehow set

Application.EnableEvents = FALSE

and not reset it back to TRUE.

In the Immediate window, thpe
Application.EnableEvents = TRUE

Go to another worksheet and then reactivate the DataInput sheet.

If this

Private Sub Worksheet_Activate()

Sheets("Data Input").Unprotect Password:="********"

ClearApplicationControls

Sheets("Data Input").Protect Password:="********"

End Sub


Is in the Data INput worksheet code, you don't need the Sheets("Data
Input"). part


"Sandy" wrote:

The following doesn,t work and I have no idea why - any suggestions?
I am assuming the code should run when the worksheet "Data Input" is
selected.

'Code in Sheet1 "Data Input"
Private Sub Worksheet_Activate()

Sheets("Data Input").Unprotect Password:="********"

ClearApplicationControls

Sheets("Data Input").Protect Password:="********"

End Sub

'Code in Module2
Sub ClearApplicationControls()

Application.ScreenUpdating = False

With ActiveWindow
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
.DisplayWorkbookTabs = True
.DisplayHeadings = False
.WindowState = xlMaximized
End With

Dim OneBar As CommandBar
On Error Resume Next
For Each OneBar In CommandBars
OneBar.Visible = False
Next
On Error GoTo 0

With Application
.DisplayFullScreen = False
.DisplayFormulaBar = False
End With

Application.ScreenUpdating = True

End Sub