Consulting

Results 1 to 4 of 4

Thread: Insert new row above specific text

  1. #1
    VBAX Regular
    Joined
    May 2015
    Posts
    44
    Location

    Insert new row above specific text

    Hi all

    Hopefully a super simple one

    I want to insert a new row above a row that contains some specific text.

    The purpose of this is to create a button on the sheet which will automatically do this for those individuals who do not know how to insert their own new rows without destroying the content of the sheet.

    The specific text will be something random like "zgx500" which shouldn't be repeated elsewhere in the doc but i will have hidden it on the Row that i never want the users to go below.

    Many thanks for any help!

    Cheers,
    Alex

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Cells.Find("zgx500").EntireRow.Insert
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Regular
    Joined
    May 2015
    Posts
    44
    Location
    Many thanks for your help!

    How would you change that to insert a row two rows above the specific text? Would this be with an offset of some kind?

    Thanks again!

  4. #4
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Cells.Find("zgx500").Offset(-1).EntireRow.Insert
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •