New Row Macro with Formula

thebestnicknar

New Member
Joined
Nov 19, 2013
Messages
4
I'm trying to cleanup a colleagues spreadsheet and create a New Row button, but also want to keep the formulas in the required fields above. The below formula creates the new row with formatting from above, but does not copy the formulas. Do I have to embed the formulas into my macro or is there a way to pull it from above?

There are formulas in I10, M10, N10, O10 and T10 which need to copied.

PHP:
Private Sub CommandButton1_Click()
Dim mySheets    
Dim i As Long        
mySheets = Array("Priority Evaluation")
For i = LBound(mySheets) To UBound(mySheets)
 With Sheets(mySheets(i))
.Range("A11").EntireRow.Insert Shift:=xlDown           
.Range("A11:V11").Borders.Weight = xlThin
End With
Next i
End Sub
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Try
Code:
.Range("A11").EntireRow.Insert shift:=xlDown
Intersect(.Range("I10:T11"), .Range("I:I,M:O,T:T")).FillDown
.Range("A11:V11").Borders.Weight = xlThin
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,216,070
Messages
6,128,614
Members
449,460
Latest member
jgharbawi

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