Insert Row Above Button and Format New Rows

cmangi

New Member
Joined
Jul 17, 2014
Messages
17
I am working on an excel file to help with our meeting minutes with my job. Currently every time there is a new item or minute the updater has to manually insert and format the cells.

I want trying to make a macro that will work by clicking a button towards the bottom that will add 4 new cells, correctly formatted, above the "New Item" button.

Follow links to images:
Before Image - https://imgur.com/zX3HaaI
After Image - https://imgur.com/CwX3RzE
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I ran into this before, here is some code to try on a copy of your true data to see if it works.
I basically recorded keyboard shortcuts to start at the top of Column " N ", go to bottom of sheet, slide over to column " A ", used control+up arrow in order to land on the " New Item " cell, insert a row, then go up a row and copy it's formatting and paste it into the new row.
If there is anything in column " N " then it will stop it, also if there is anything under the " New item " cell...
This is what it looks like you are wanting, we can tweak it if necessary; ( Of course you will have to set the button where you want it, to activate)

Sub InsertSheetRow()
'
' InsertSheetRow Macro
'

'
Range("M1").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, -13).Range("A1").Select
Selection.End(xlUp).Select
Selection.EntireRow.Insert
ActiveCell.Offset(-1, 0).Range("A1:P1").Select
Selection.Copy
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone _
, SkipBlanks:=False, Transpose:=False
ActiveCell.Offset(1, 0).Range("A1").Select
Range("M1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = ""
Range("N1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, -13).Range("A1").Select
Selection.End(xlUp).Select
ActiveCell.Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,781
Messages
6,126,863
Members
449,345
Latest member
CharlieDP

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