Hello I need some help with the following macro which I am using to clear the contents of specific cells.
Basically the macro should select cells C9:F9 clear the contents and then loop down 7 rows to C16:F16, clear those cells and then keep on looping by 7 rows until it reaches the lastrow but I can’t seem to get it to work so any help would be appreciated, thanks in advance
Sub ClearDataInput()
Dim lastRow As Long
Dim Row As Long
Dim x As Long
Application.ScreenUpdating = False
Row = 9
For x = 9 To lastRow
With Sheet5
.Select
lastRow = .Range("c7").SpecialCells(xlCellTypeLastCell).Row
.Range("C" & Row & ": f" & Row).Select
Selection.ClearContents
Row = Row + 7
End With
Next x
Application.ScreenUpdating = True
End Sub
Basically the macro should select cells C9:F9 clear the contents and then loop down 7 rows to C16:F16, clear those cells and then keep on looping by 7 rows until it reaches the lastrow but I can’t seem to get it to work so any help would be appreciated, thanks in advance
Sub ClearDataInput()
Dim lastRow As Long
Dim Row As Long
Dim x As Long
Application.ScreenUpdating = False
Row = 9
For x = 9 To lastRow
With Sheet5
.Select
lastRow = .Range("c7").SpecialCells(xlCellTypeLastCell).Row
.Range("C" & Row & ": f" & Row).Select
Selection.ClearContents
Row = Row + 7
End With
Next x
Application.ScreenUpdating = True
End Sub