I am trying to get a piece of code to clear the data in some cells, using the column references. I am using the following code:
Worksheets(sheetname).Range(.
To clear all rows that have data I use two variables like this. I like this because you can adjust it to a certain range of columns if you need to. Dim CRow As Integer Dim LastRow As Integer
CRow = 1
LastRow = Cells(Rows.Count, 3).End(xlUp).Row
Do Until CRow = LastRow + 1
Cells(CRow, 1).Value = Empty
Cells(CRow, 2).Value = Empty
Cells(CRow, 3).Value = Empty
Cells(CRow, 4).Value = Empty
CRow = CRow + 1
Loop