+ Reply to Thread
Results 1 to 3 of 3

VBA lock worksheet with 'Format Columns' checked

  1. #1
    Registered User
    Join Date
    05-01-2018
    Location
    Maine
    MS-Off Ver
    2010
    Posts
    36

    VBA lock worksheet with 'Format Columns' checked

    Thank you in advance for any assistance you can provide. I have a rather extensive VBA code that opens a locked workbook, opens a locked sheet, performs some functions, locks the sheets and finally locks the workbook. The code has worked well for us to this point but we now have a process that requires the function 'Format Columns' to be checked when the worksheet locks with VBA. I am not the original person who wrote the code but I think this is the line of the code may need to be modified from the Maineroutine Sub (full code below):

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Just to clarify the MaineRoutine as this may be where it need modified as mentioned above:

    Please Login or Register  to view this content.
    Sorry for it being a long post but the routine is much longer than what I have included above. I am just trying to modify this code to leave 'Format Columns' and 'Select Unlocked Cells' checked when it locks the worksheet (after running its routine). I have attempted to modify this with macro recorder but this code:

    Please Login or Register  to view this content.
    does not seem to work when inserted into the Private Sub IF statement. Excel returns an error stating that it needs to be defined.

    I am at a loss as I am unsure how to properly address that small issue with an intricate code like this.

    Any help at all is greatly appreciated.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    8,461

    Re: VBA lock worksheet with 'Format Columns' checked

    I think this is what you want (not tested).

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in your menu for the forum editor will apply the CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    05-01-2018
    Location
    Maine
    MS-Off Ver
    2010
    Posts
    36

    Re: VBA lock worksheet with 'Format Columns' checked

    This is exactly what I was needing. I guess where I must have been making a mistake was in allowing to run on active sheets with the macro recorders code. Thank you again for your assistance AlphaFrog. This worked perfectly.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1