Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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!
.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default deleting a variable number of columns

Rob

That works a treat.

Thank you for your help

Phillip



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default deleting a variable number of columns

Phillip,

You can also use the following notation (just another way)

ActiveSheet.Range(Columns(1st column #),Columns(last column #)).Delete

this notation just makes it clearer that you are working on columns.

steve

"phillip harrison" wrote in message
...
Rob

That works a treat.

Thank you for your help

Phillip



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding variable number of columns fabio Excel Worksheet Functions 8 May 23rd 10 07:30 AM
deleting number and alphabet columns and rows. Maryann Excel Discussion (Misc queries) 1 May 17th 08 09:52 AM
sum number of columns based on variable value rt10516 Excel Discussion (Misc queries) 4 November 8th 07 01:47 PM
Macro - Using a variable number of columns in a Range stumped Excel Discussion (Misc queries) 2 October 3rd 06 08:13 PM
adding variable number of columns confused Excel Worksheet Functions 5 September 23rd 05 10:09 AM


All times are GMT +1. The time now is 03:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"