+ Reply to Thread
Results 1 to 2 of 2

VBA to insert row and copy formating from above

  1. #1
    Registered User
    Join Date
    04-19-2012
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2007
    Posts
    7

    VBA to insert row and copy formating from above

    Hi!

    I am trying to figure out the code that will copy the contents and formatting from the row above a selected cell. I have already figured out how to insert the row, but I can't get it to copy the formatting... can anyone help me?

    Here is what I have so far...

    Sub Insert()
    Selection.EntireRow.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    End Sub

    Thanks
    Randi

  2. #2
    Registered User
    Join Date
    04-19-2012
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: VBA to insert row and copy formating from above

    figured it out from another forum!

    Sub AddRow()
    Dim rng As Range
    Set rng = Selection
    Selection.EntireRow.Insert
    Selection.Offset(-1, 0).EntireRow.Copy
    Selection.EntireRow.PasteSpecial (xlFormats)
    Application.CutCopyMode = False
    rng.Select
    End Sub

+ 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] VBA codes to insert the rows and copy the first entire row text and insert sheet
    By PRADEEPB270 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-26-2013, 05:05 AM
  2. [SOLVED] I want to insert a row and copy the formula with the correct formating
    By Turtleman10 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-30-2012, 03:39 PM
  3. use a v-Lookup or conditional formating to insert images
    By thekobk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-02-2007, 02:16 PM
  4. Replies: 6
    Last Post: 08-14-2006, 05:00 PM
  5. [SOLVED] Conditional formating-Is there a way to insert
    By nitsa in forum Excel General
    Replies: 2
    Last Post: 06-01-2006, 05:20 AM

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