View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
T De Villiers[_91_] T De Villiers[_91_] is offline
external usenet poster
 
Posts: 1
Default Deleting selective columns


Hi, I have 25 columns.
I need to write a macro which goes through each column and
keeps:
1) Billing
2) GM
3) Total
4) Client
5) Project Name

I guess its something like this, many thks

sub del()

Dim i As Long
Dim aryTest

aryTest = Array("Billing ", "GM", "Total","Client","Project Name")

For i = 25 To 1 Step -1
If Not IsError(Application.Match(Cells(1, i).Value, aryTest, 0)) Then
'Keep
Else
'Delete
End If
Next i


End Sub


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=567538