I have a spreadsheet, and I have managed to get the right code that inserts a row below the current insertion point:
Sub InsterRow()
'Insert row below active cell
ActiveCell.Offset(1).EntireRow.Insert
End Sub
This also adds the right formatting and conditional formatting to the new row, but doesn't merge the celss that are merged above.
I have tried recording a new macro to figure out the code, but I'm not sure how to make this code variable instead of specific to the cells named:
Sub format()
'
' format
'
Range("B19:D19").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Selection.Merge
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.MergeCells = True
End With
Selection.InsertIndent 1
Range("G19:H19").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Selection.Merge
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.MergeCells = True
End With
Selection.InsertIndent 1
End Sub
Any ideas from you pros??
Pesh
Sub InsterRow()
'Insert row below active cell
ActiveCell.Offset(1).EntireRow.Insert
End Sub
This also adds the right formatting and conditional formatting to the new row, but doesn't merge the celss that are merged above.
I have tried recording a new macro to figure out the code, but I'm not sure how to make this code variable instead of specific to the cells named:
Sub format()
'
' format
'
Range("B19:D19").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Selection.Merge
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.MergeCells = True
End With
Selection.InsertIndent 1
Range("G19:H19").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Selection.Merge
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.MergeCells = True
End With
Selection.InsertIndent 1
End Sub
Any ideas from you pros??
Pesh