Results 1 to 3 of 3

When user inserts new row, copy formulas/formatting from the row above

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-15-2009
    Location
    Herndon, VA
    MS-Off Ver
    Excel 2010
    Posts
    163

    When user inserts new row, copy formulas/formatting from the row above

    If the user inserts a row, I want all formatting/formulas/data validation from the row above to be inherited in the newly inserted row. I want this to occur on sheet1.

    When you insert a new row, although the entire new row is selected, the active cell is the cell in column A. So I figured I could base a routine off of the active cell. Here is what I tried:


    Private Sub insertRow( )
    
    Range(ActiveCell.Offset(-1, 0), ActiveCell.Offset(-1, 0).End(xlToRight).Offset(1, 0)).Filldown
    
    End Sub

    I am trying to reference a range. The first cell in the range is above the active cell. The second cell in the Range is above, the active cell, then to the right of the range, then down one. By referring to this Range, I am then trying to use the FillDown method. This code isn't doing anything.

    Any suggestions would be appreciated.

    Also, I need Excel to automatically run this code when the user inserts a new cell on sheet1. Would I need an event handler or just put this code inside of the Sheet1 code window?
    Last edited by Excel_vba; 01-29-2014 at 11:27 PM. Reason: Forgot

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro that Inserts a row in between rows (with formulas etc)
    By How How in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-14-2013, 07:49 AM
  2. Problem with macro that inserts a row, and copies formulas but not the values.
    By CRIMEDOG in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-14-2010, 03:16 PM
  3. Create GUI in excel - user inserts part number & all applicable upgrades are shown.
    By canadiancowboy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2010, 12:52 PM
  4. User Form field inserts wrong date format
    By simjambra in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-26-2009, 04:09 PM
  5. Detecting when Excel user inserts or deletes a row
    By wjewell in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-02-2005, 06:20 PM

Tags for this Thread

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