+ Reply to Thread
Results 1 to 4 of 4

Insert a new top row if data entered in any column

  1. #1
    Registered User
    Join Date
    01-14-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    8

    Insert a new top row if data entered in any column

    I found the code to always be entering data into the top row, so that when you hit enter it moves everything down for you and gives you a blank row. BUT, is there a way for that to happen when data is entered into any of the columns?

    So if my table data entry row is A4 thru D4. If I enter data anywhere in those 4 cells and hit enter it will move the data and give me a new row?
    Attached Files Attached Files
    Last edited by DarkPurpleInk; 06-23-2023 at 12:11 PM.

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,504

    Re: Insert a new top row if data entered in any column

    I'm a bit confused and surprised that you want to insert a new row when the curent row hasn't been filled yet.
    Can you confirm again: Should a new row be inserted when any cell in the range A4:D4 is filled, meaning one cell is filled and three cells are still empty?

    Anyway, let's give this code a try and implement it according to your request:
    PHP Code: 
    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    On Error GoTo enditall
    Application
    .EnableEvents False
    If Intersect(TargetRange("A4:D4")) Is Nothing Or Target.Count Or IsEmpty(TargetThen Exit Sub
    Range
    ("D4").EntireRow.Insert
    Range
    ("A4").Select
    enditall
    :
    Application.EnableEvents True
    End Sub 
    Quang PT

  3. #3
    Registered User
    Join Date
    01-14-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    8

    Re: Insert a new top row if data entered in any column

    Thank you! That is exactly what I needed.
    Reasoning being sometimes I am not given all the info and have to do partial entries.

  4. #4
    Registered User
    Join Date
    01-14-2022
    Location
    US
    MS-Off Ver
    365
    Posts
    8

    Re: Insert a new top row if data entered in any column

    I'm back again. It was working fine until I tried to add it to a different spreadsheet. It is making a new line when I hit the "tab" button. Can it be made to only make a new like if "enter" is hit?

+ 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. Automatically insert a new blank row above each new value entered in a column
    By MikeOttawa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-22-2023, 10:46 PM
  2. [SOLVED] Formula, insert increase number in column (count up), as date entered
    By EsquireVA in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-21-2020, 10:15 AM
  3. [SOLVED] Drowdown list to insert entered CUSTOMER INFO in rows into column on invoice
    By jcy110 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-19-2016, 01:40 PM
  4. [SOLVED] if data is entered in column A, column B should have date automatically entered.
    By exceltriumph in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-30-2016, 12:02 PM
  5. [SOLVED] Insert row in table after entered data
    By bidsinga in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-23-2014, 05:35 PM
  6. Insert new row below data already entered
    By chris19 in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 04-02-2013, 06:15 PM
  7. Auto insert date, time & user in columns when data is entered in another column?
    By shelbsassy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-16-2007, 02:59 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