I have the following question with this working VBA code and would appreciate some help (if at all possible) to make the code faster. Especially when clearing up to 50 cells.
The shown VBA code is copying the last row of a table and inserts it below.
Some cells are cleared from its contents. The code does it one by one.
I'm sure there must be a faster way to "ClearContents" the cell by cell.
Can somebody help me?
VBA code:
The shown VBA code is copying the last row of a table and inserts it below.
Some cells are cleared from its contents. The code does it one by one.
I'm sure there must be a faster way to "ClearContents" the cell by cell.
Can somebody help me?
VBA code:
Code:
Private Sub Add_Click()
Sheets("Overview").Unprotect Password:="XXX"
myCheck = MsgBox("new project?", vbYesNo)
If myCheck = vbNo Then Exit Sub
ActiveSheet.Range("i65536").End(xlUp).EntireRow.Select
Selection.Copy
ActiveSheet.Range("i65536").End(xlUp).Offset(1, 0).EntireRow.Select
Selection.Insert
Range("J" & (ActiveCell.Row)).Value = Date
Range("K" & (ActiveCell.Row)).ClearContents
Range("L" & (ActiveCell.Row)).ClearContents
Range("N" & (ActiveCell.Row)).ClearContents
'and so on!
End Sub
Last edited by a moderator: