PDA

View Full Version : Clear contents



Klartigue
08-19-2013, 10:00 AM
For columns A through N,

I am trying to write a code that says, for any cells which are blank in column A, then clear the contents in the range, column A through N.

So on the attached sheet, I would want to clear contents for the area A6-N(all the way down to the end of the entire excel sheet.)

Can you help with this?

Kenneth Hobs
08-19-2013, 11:00 AM
Are you sure that you want to only leave column A-N rows 12, 17, 22, 27, and 32?

Maybe if you added and after sheet we could see what you want.

david000
08-19-2013, 11:22 AM
Sub Test2()
Dim wk As Worksheet
Dim LastRow As Long
Dim cel As Range

Set wk = ActiveSheet

With wk
LastRow = Range("A" & Rows.Count).End(xlUp).Row

For Each cel In Range("A6").Resize(LastRow - 1).SpecialCells(xlCellTypeBlanks)

cel.Resize(, 12).ClearContents

Next cel

End With
End Sub

snb
08-19-2013, 02:03 PM
or

Sub M_snb()
columns(1).specialcells(4).entirerow.clearcontents
end sub