+ Reply to Thread
Results 1 to 2 of 2

Combining auto-locking VBA code and auto-expanding a table

  1. #1
    Registered User
    Join Date
    03-31-2014
    Location
    Wisconsin
    MS-Off Ver
    Excel 2016
    Posts
    20

    Combining auto-locking VBA code and auto-expanding a table

    The following code in a spreadsheet that is used by production staff to enter testing results. I would like to reformat the data entry fields into a table that will automatically expand when the user needs a new line. Currently they have to find someone with the password, who unlocks the spreadsheet and adds more lines (and they don't always do it correctly so the formatting gets messed up). The code works as is, locking the cells as data is entered, but it won't allow me to use a 'tab' in the last cell of the current table in order to add a new line.


    I will attempt to attach a small Excel sheet, hopefully it works for me this time!
    Thank you for the assistance,
    DixieLou


    Here is the current code:

    # Private Sub Worksheet_Change(ByVal Target As Range)
    Dim c As Range
    ActiveSheet.Unprotect Password:="TEST"
    For Each c In Target
    c.MergeArea.Locked = (c.Value <> "")
    Next c
    ActiveSheet.Protect Password:="TEST"
    End Sub #
    Attached Files Attached Files
    Last edited by DixieLou; 11-14-2019 at 10:11 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,444

    Re: Combining auto-locking VBA code and auto-expanding a table

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)

+ 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. Auto Generate Additional Template from Expanding Table
    By schs4 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-26-2016, 01:24 PM
  2. Auto Expanding Tables
    By marlz in forum Excel General
    Replies: 0
    Last Post: 10-15-2014, 10:48 AM
  3. [SOLVED] Table not auto-expanding
    By teenyjem in forum Excel General
    Replies: 3
    Last Post: 01-21-2014, 05:33 AM
  4. [SOLVED] Cell not auto-locking after auto-populating
    By Hillster in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-13-2012, 10:23 AM
  5. auto expanding table move calculates totals down
    By GHServices in forum Excel General
    Replies: 0
    Last Post: 10-10-2011, 01:12 PM
  6. Auto expanding Range
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-30-2005, 03:05 PM
  7. [SOLVED] Auto Expanding Pie Chart
    By Edgar Thoemmes in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-09-2005, 12:06 AM

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