PDA

View Full Version : ClearContents (Differnt columns)



av8tordude
11-12-2012, 04:32 AM
I have this code that clears the contents in the first 28 columns in the active row. How can I include columns 95 to 107 (ignoring 29 - 94)

ActiveCell.Resize(, 28).ClearContents

p45cal
11-12-2012, 04:44 AM
I have this code that clears the contents in the first 28 columns in the active row.
Not quite; it will only do this if the active cell is in column A, if the active cell is in any other column, the cells cleared will be the active cells and the 27 cells to the right of it.
It might be safer to have:
cells(activecell.row,"A").resize(,28).clearcontents

How can I include columns 95 to 107 (ignoring 29 - 94)Perhaps by adding a second line:
cells(activecell.row,"A").offset(,94).resize(,13).clearcontents