Hi!
I have written a code that creates new lines above a given section and should copy the formatting and formulas from the row above. However, the line for copying formulas also carries over values which I would like to avoid.. The sub looks as follows:
Private Sub CommandButton1_Click()
Dim c As Long
For c = 100 To 1 Step -1
If Cells(c + 1, 3) Like "Next section" Then
Cells(c + 1, 1).EntireRow.Insert
Rows(c).Copy
Rows(c).Offset(1, 0).EntireRow.PasteSpecial Paste:=xlPasteFormats
Rows(c).Offset(1, 0).EntireRow.PasteSpecial Paste:=xlPasteFormulas
Application.CutCopyMode = False
End If
Next c
End Sub
Does anyone know how I should amend the sub to clear the values? Alternatively, I'd like to delimit the copying to columns K, L and O.
Any help is greatly appreciated!
/Tristan
I have written a code that creates new lines above a given section and should copy the formatting and formulas from the row above. However, the line for copying formulas also carries over values which I would like to avoid.. The sub looks as follows:
Private Sub CommandButton1_Click()
Dim c As Long
For c = 100 To 1 Step -1
If Cells(c + 1, 3) Like "Next section" Then
Cells(c + 1, 1).EntireRow.Insert
Rows(c).Copy
Rows(c).Offset(1, 0).EntireRow.PasteSpecial Paste:=xlPasteFormats
Rows(c).Offset(1, 0).EntireRow.PasteSpecial Paste:=xlPasteFormulas
Application.CutCopyMode = False
End If
Next c
End Sub
Does anyone know how I should amend the sub to clear the values? Alternatively, I'd like to delimit the copying to columns K, L and O.
Any help is greatly appreciated!
/Tristan