VBA Code:
Sub insert()
Dim sheetname As String
sheetname = Sheet2.Name
If sheetname = ActiveSheet.Name Then
Range("A1:A100000").EntireRow.Hidden = False
Range("E100000").Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
ActiveCell.Offset(0, -4).Range("A1:CZ3").Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:CZ6"), Type:=xlFillDefault
ActiveCell.Offset(3, 0).Range( _
"A2:A3,B2:B3,C2:C3,F2:F3,H2:M3,Q2:R3,X2,AA2,AD2,AG1:AZ3,BC2:CV3").Select
Selection.ClearContents
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveCell.Offset(-1, 0).Range("AG1:AZ1").Select
Selection.FormulaR1C1 = "HAKA"
ActiveCell.Offset(0, -28).Range("A1").Select
End If
End Sub
I used autofill to prevent breaking existing conditional formatting when adding new formated rows with formala.
Kindly advise. Thanks
Last edited by a moderator: