Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7931835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:50:08+00:00 2026-06-03T20:50:08+00:00

To insert a row or column is generally easy with vba. However, do it

  • 0

To insert a row or column is generally easy with vba. However, do it automatically in a locked cell according to user input is not easy. My question is
How to automatically insert formatted style row or column in a locked Excel sheet saved as xlsm?

Explain:

I have a sheet called “Sheet1” is a locked with password, “ABCD”, user can only input the data in the colored area. However, sometimes the list is short, while others are long. Automatically insert row and column is a good idea like data-grid in Visual Studio.

Please see the picture, if user enters anything in row 9 in the colored area, then it automatically create a formatted-style row 10 (for Components List 1). If user enter anything to empty row 14, then it inserts row 15 in Components List 2.

Same thing if user enters anything in column H, then I create column I

enter image description here

I do not know how to write the syntax but here is my thoughts on the design:

I must define a name for area in components List 1 (Com1), Components List 2 (Com2), and the blue area (Part_quality) so the program knows which area if should check for user input

Checking if user input data in defined names range. If yes, check if user enter any data in the last row and last column. If yes, unlock the file with predetermined password stored in memory, insert row/column, then locked it

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:50:09+00:00Added an answer on June 3, 2026 at 8:50 pm

    enter link description here

    Is this what you are trying?

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim MRange As Range, rng As Range
    
        On Error GoTo Whoa
    
        Set MRange = Range("InputRange")
    
        '~~> Get the last Row of the range
        Set rng = MRange.Range(MRange.Cells(MRange.Rows.Count, 1), _
        MRange.Cells(MRange.Rows.Count, MRange.Columns.Count))
    
        '~~> Trap changes in the last row of the range
        If Not Intersect(Target, rng) Is Nothing Then
            'If Application.WorksheetFunction.CountA(rng) > 0 Then
                'Application.EnableEvents = False
    
                'rng.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
            'End If
        End If
    
    LetsContinue:
        Application.EnableEvents = True
        Exit Sub
    Whoa:
        MsgBox Err.Description
        Resume LetsContinue
    End Sub
    

    The code is created by Siddharth Rout

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anyone have any suggestions on how to insert a row or column in a
I'm using the following code to insert a row with a timestamp column into
When I insert a new row the treeId column is always 1. The treeId
In MS Access, how do I insert a row which has one column that
is it possible to insert a table row that doesn't adhere to any columns?
I want to insert row for each day to add new values, and I
How can I perform an idempotent insert row using subsonic with a SQL 2008
I want to insert a row into the Database using SqlDataAdapter. I've 2 tables
I have one multi-row INSERT statement (300 or so sets of values) that I
I have a multi-row insert that looks something like: insert into table VALUES (1,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.