Full Version: Remove Row & Column Headings from spreadsheet...
UtterAccess Discussion Forums > Microsoft® Office > Microsoft Excel
adaytay
Hi all,

Long story short, I have a key combination that will lock down or unlock all sheets on demand for specified users.

As part of this code, when the sheets are unlocked, the row and column headings are being displayed.

Here's the code:

CODE
        If ActiveSheet.ProtectContents Then
            'Current Worksheet is protected, so unlock them all
            For Each ws In ActiveWorkbook.Worksheets
                ws.Unprotect strWSPassword
                'Show Headings etc
                ws.Activate
                With ActiveWindow
                    .DisplayHeadings = True
                End With
            Next
        Else
            For Each ws In ActiveWorkbook.Worksheets
                ws.Protect strWSPassword
                'Hide Headings etc
                ws.Activate
                With ActiveWindow
                    .DisplayHeadings = False
                End With
            Next ws
        End If


Now, despite me disabling the screen updating, when I hit the key combo do do the work, the system is flicking through each sheet visibly to unlock it. I guess it's because I'm activating the worksheet and then displaying headings. Is it possible to do this on the sheet level?

Thanks in advance,

Ad
norie
Adam

Where are turning off screen updating?

I can't see that happening in the posted code.dazed.gif
adaytay
I'm turning it off earlier in the procedure by doing application.screenupdating = false

Cheers,

Adam

Edited by: adaytay on Wed Feb 11 4:44:39 EST 2009.
adaytay
Resolved.

Setting Application.EnableEvents=False immediately after locking the screen resolved the issue. (And then setting it to true again before unlocking it again, obviously).

Ad
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.