Clearing cells

K

knox5731

I have the following code to clear columns at a specific cell number
and then all the way down the column, but I get a "invalid or
unqualified reference" error. Why is that? It stops on the .Cells
portion.....

Help?

Sheets("Generator").Select
.Range("b14:b" & .Cells(Rows.Count, "B").End(xlUp).Row).ClearContents
.Range("c14:c" & .Cells(Rows.Count, "C").End(xlUp).Row).ClearContents
.Range("d14:d" & .Cells(Rows.Count, "D").End(xlUp).Row).ClearContents
.Range("e14:e" & .Cells(Rows.Count, "E").End(xlUp).Row).ClearContents
.Range("f14:f" & .Cells(Rows.Count, "F").End(xlUp).Row).ClearContents
.Range("g14:g" & .Cells(Rows.Count, "G").End(xlUp).Row).ClearContents
.Range("i14:i" & .Cells(Rows.Count, "I").End(xlUp).Row).ClearContents
 
P

PCLIVE

I'm not sure you need the periods before "Range" and "Cells".

Try this:

Sheets("Generator").Select
Range("b14:b" & Cells(Rows.Count, "B").End(xlUp).Row).ClearContents
Range("c14:c" & Cells(Rows.Count, "C").End(xlUp).Row).ClearContents
Range("d14:d" & Cells(Rows.Count, "D").End(xlUp).Row).ClearContents
Range("e14:e" & Cells(Rows.Count, "E").End(xlUp).Row).ClearContents
Range("f14:f" & Cells(Rows.Count, "F").End(xlUp).Row).ClearContents
Range("g14:g" & Cells(Rows.Count, "G").End(xlUp).Row).ClearContents
Range("i14:i" & Cells(Rows.Count, "I").End(xlUp).Row).ClearContents
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top