+ Reply to Thread
Results 1 to 5 of 5

If data is in a row above, insert a new row above.

  1. #1
    Registered User
    Join Date
    04-16-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    45

    If data is in a row above, insert a new row above.

    Hello, I am wondering if there is any way to have it so if there is any data in column B-F, it will keep an extra row between the values from Column A.

    This would make it so that my I could always have a blank row between data about different jobs.

    So if A5 has a job number, and B4-F4 has data in it, A row would be inserted above Row A5, making the cell that was in A5, now in A6.

    However if B4-F4 is blank, it is left in A5 and not pushed down to A6.

    It wouldn't matter what cell its the fourth row, just as soon as it does, a blank row is created.

    Sorry if this is confusing at all, but I had no idea how to word all this.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: If data is in a row above, insert a new row above.

    Hi, Dagoom,

    maybe like this (assuming that data is filled in continuously from B to F for any row):
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    04-16-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: If data is in a row above, insert a new row above.

    It was pretty close to what I want, except it only inserted a blank in one spot, is there anyway to have it do multiple rows at the same time?

    Also, it is not always continuous, it contains data about contact information and such, sometimes I will not have emails, so is there any way to have it so that if ANY of the cells are filled, it creats a blank row?

    Also, is there any way to have this be automatic on a sheet? I tried to put it in the code area, but I still need to manually run it.
    Last edited by Dagoom; 10-31-2013 at 02:19 AM.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: If data is in a row above, insert a new row above.

    Hi, Dagoom,

    It was pretty close to what I wan
    Good guess of mine withhout seeing your data and maybe noticing what might be wrong. As I mentioned before the code supplied assumes an entry into any column from B to F for the row which may cause the code to refuse to insert a new row where it should be. And I assumed values to be located in the cells, not formulas.

    You could try the altered code and see if this works alright for you:
    Please Login or Register  to view this content.
    Or maybe attach a workbook with a sample of where the code doesnŽt fulfill like wanted.

    Automatism: depending on what event should be watched to trigger the event. IŽll start with the Worksheet_Actiate which will cause the code to run whenever the sheet is activated either by code or manually. Depending on whether the data is entered manually (Worksheet_Change) or imported by formula (Worksheet_Calculate) these events could be taken into consideration as well.

    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    04-16-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: If data is in a row above, insert a new row above.

    You hit the nail on the head there,

    Thank you very much!

    How would I go about making it so whenever a cell is edited, the macro would run?

    Sorry, I am still kind of new to how excel works, and migrated from Quattro pro.

    I really appreciate you taking your time to help me out.

    Alright, I found out how to make it do what I wanted.

    Please Login or Register  to view this content.
    Thanks a bunch.
    Last edited by Dagoom; 10-31-2013 at 02:47 AM.

+ 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. [SOLVED] Loop through entire sheet, Insert row, copy row data, paste row data, delete row
    By Hyperdude in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-19-2012, 01:46 AM
  2. testing data, insert formula depending on data length
    By davidparkes in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-02-2011, 06:22 PM
  3. Copy paste data, insert rows, insert data and change . to -
    By xWiZardx in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-16-2010, 01:44 AM
  4. Replies: 5
    Last Post: 09-15-2008, 07:04 PM
  5. [SOLVED] insert entire row for new data, external data range doesnt work
    By orlya1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-03-2006, 03:45 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