LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Select and Delete Columns

The following code is an example that will work for you, may need
modifying if you have a large spreadsheet as my example only deletes
one column at a time.

Dave, Kendal


Sub test()
Cells.Select
Selection.Sort Key1:=Range("A3"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Application.Goto Reference:="R3C1"
While IsEmpty(ActiveCell) = False
If ActiveCell = 0 Then
ActiveCell.EntireColumn.Delete
ElseIf ActiveCell 0 Then
ActiveCell.Offset(0, 1).Range("A1").Select
End If
Wend
End Sub






"jacqui" wrote in message ...
Rob,
Thanks for your suggestion. Unfortunately the i counter
doesn't work when the code finds a column to delete 'cause
what should be the next column to test becomes the current
column in the loop and then the counter increments again
so it's effectively skipping a column each time. That's
why I was going to work the loop from right to left rather
than left to right.
Can you help I'm still stuck with the syntax
Jacqui




 
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
How to delete a 'Select Box' Bodin Excel Discussion (Misc queries) 1 April 28th 09 01:53 AM
Search & delete ANY text in select columns huruta Excel Discussion (Misc queries) 2 June 30th 06 07:31 PM
Delete Select Targets Dathmar Excel Discussion (Misc queries) 1 August 24th 05 04:36 PM
How to select a row to delete Jeff Armstrong Excel Programming 2 November 12th 03 03:38 PM
Conditional Row Select and Delete jagstirling[_5_] Excel Programming 3 September 30th 03 08:46 AM


All times are GMT +1. The time now is 08:51 AM.

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

About Us

"It's about Microsoft Excel"