Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adding variable number of columns | Excel Worksheet Functions | |||
deleting number and alphabet columns and rows. | Excel Discussion (Misc queries) | |||
sum number of columns based on variable value | Excel Discussion (Misc queries) | |||
Macro - Using a variable number of columns in a Range | Excel Discussion (Misc queries) | |||
adding variable number of columns | Excel Worksheet Functions |