Posted to microsoft.public.excel.programming
|
|
VB to delete columns except these...
sub deletecolumns()
dim i as long
for i=cells(1,columns.count).end(xltoleft).column to 1 step -1
if cells(1,i)<"Test1" and cells(1,i)<"Test2" then columns(i).delete
next i
end sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"AndrewB" wrote in message
...
Hello,
I have an Excel worksheet called "Sheet1" and I am looking for a way to
automatically delete all columns in Sheet1 that are not named "Test1" and
Test2". Can someone assist?
--
AndrewB.
|