Format of inserted row

pilot

Active Member
Joined
Feb 17, 2002
Messages
345
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?
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Wanted to raise this to the top of the stack one time since no takers. Any info appreciated.
 
Upvote 0
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
 
Upvote 0
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).
 
Upvote 0

Forum statistics

Threads
1,223,365
Messages
6,171,654
Members
452,415
Latest member
mansoorali

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top