+ Reply to Thread
Results 1 to 3 of 3

VBA lock worksheet with 'Format Columns' checked

  1. #1
    Forum Contributor
    Join Date
    05-01-2018
    Location
    Maine
    MS-Off Ver
    2010
    Posts
    114

    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
    9,643

    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 the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    05-01-2018
    Location
    Maine
    MS-Off Ver
    2010
    Posts
    114

    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)

Similar Threads

  1. Lock a Form Control Checkbox once it is checked
    By asciscioli in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-20-2018, 05:27 PM
  2. Replies: 1
    Last Post: 05-23-2016, 01:53 PM
  3. Replies: 1
    Last Post: 09-04-2014, 03:39 AM
  4. Replies: 2
    Last Post: 12-19-2012, 11:23 PM
  5. Replies: 1
    Last Post: 05-22-2009, 11:30 AM
  6. [SOLVED] lock rows and columns on a web Excel worksheet.
    By User Friendly in forum Excel General
    Replies: 0
    Last Post: 08-17-2006, 08:35 AM
  7. How To Lock Cells and Columns without Protecting Worksheet
    By lostinformulas in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-13-2006, 06:00 PM

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