Clearing a column

  • Thread starter Thread starter grovesy
  • Start date Start date
G

grovesy

Hi all,

This question is in two parts.

1) How do you clear an entire column of date in vb code?
2)Is it possible to clear an entire column excluding some cells withi
that colume? For example;

Lets say i want to clear column "A" but want to exclude "A1" and "A2
from this clear function

Is this possible? How!

Cheers al
 
Hi Grovessy,

To delete contents and format:

1) Columns(1).Clear

2) Columns(1).Rresize(Rows.Count-2).Offset(2).Clear

To delete contents but retain formatting, replace Clear with ClearContents.
 
Cheers Norman,

The first method does clear the entire column :)

Unfortunately the second one (The clear column excluding some cells
give me an error;

-Object doesn't support this property or method-

Any ideas?

Thanks agai
 
Hi Grovesy,

A typo! Change:

Columns(1).Rresize(Rows.Count-2).Offset(2).Clear

to:

Columns(1).Resize(Rows.Count-2).Offset(2).Clear
 
grovesy > said:
Hi all,

This question is in two parts.

1) How do you clear an entire column of date in vb code?
range("A1").EntireColumn.ClearContents

2)Is it possible to clear an entire column excluding some cells within
that colume? For example;

Lets say i want to clear column "A" but want to exclude "A1" and "A2"
from this clear function

range("A3","A65536").ClearContents

you can add ranges with Union
union(range("C1","C30"),range("C32","C65536")).ClearContents

HTH
Cecil
 
Thanks Norman,

I should have spotted that!

You've been a great help

Chri
 

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

Back
Top