Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Format of inserted row

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    Clovis, NM
    Posts
    345
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Excel 97 - When inserting a row using the right click shortcut, the inserted row adopts formatt characteristics of the row above. Is there a way to make it adopt the format of the row below instead?

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Location
    Clovis, NM
    Posts
    345
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Wanted to raise this to the top of the stack one time since no takers. Any info appreciated.

  3. #3
    MrExcel MVP Tom Urtis's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, California USA
    Posts
    11,168
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    See if this helps at all.

    Right click on your sheet tab name, left click on View Code, and paste this in:

    '''''''''''''''''''''''''''''''''''''

    Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    Dim Resp As Integer
    Resp = MsgBox("Do you want to insert a row here?", 68, "Just checking...")
    If Resp = 7 Then Exit Sub
    Application.ScreenUpdating = False
    ActiveCell.EntireRow.Insert
    ActiveCell.Offset(1, 0).EntireRow.Copy
    ActiveCell.EntireRow.PasteSpecial (xlPasteFormats)
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
    Cancel = True
    End Sub

    ''''''''''''''''''''''''''''''''''''

    Then, follow the prompts when you right click on that sheet.

    HTH

  4. #4
    Guest

    Default

    Thanks, Tom. I knew this was possible through VBA but hadn't gone to the effort of writing the code.

    I usually try to accomplish such tasks without macros because much of what I do with other users involves running Excel over a network and the macro warning is enabled by default. I find that most users I work with will not enable macros as soon as they see any verbiage about virus protection.

    It would be nice if Excel made this a global option (choosing whether format of row above or below, left or right is used on Inserted row, column).

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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