View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Barnard Rob Barnard is offline
external usenet poster
 
Posts: 5
Default deleting a variable number of columns

Hi Phillip,

You might like to try something like:

ActiveSheet.Range(Cells(1,1),Cells
(1,delCol)).EntireColumn.Delete

:-)

Rob

-----Original Message-----
Hi there,

I've got a little problem which i hope someone will be

able to help me
with please.

I have a macro that counts the number of columns as it

processes a table
of data, this number goes into a variable called

ColCount. After a
variable number of column headings (the first row of the

table contains
the column headings) the headings change from letters to

numbers, these
numbered column headings are not only included in

ColCount but also in a
new counter called SaveCol. This is becuase i need to

delete all the
columns before those starting with numbers.

At the moment all i have is another variable called

delCol which is set
to:

delCol = ColCount - SaveCol.

I think i need to use somethink like:
ActiveSheet.Columns("A:delCol").EntireColumn.Dele te

but as im sure you can alls see "A:delCol" is not allowed.

Any help would be greatly appreciated

Thanks

Phillip

*** Sent via Developersdex http://www.developersdex.com

***
Don't just participate in USENET...get rewarded for it!
.