Thread: Excel 2003
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Excel 2003

Sub columnator()

Set r = ActiveSheet.UsedRange
nLastColumn = r.Columns.Count + r.Column - 1
nFirstcolumn = r.Column

For i = nLastColumn - 1 To nFirstcolumn + 1 Step -1
Columns(i).EntireColumn.Delete
Next

End Sub
--
Gary's Student
gsnu200712


"Kim Kautzmann" wrote:

I have a spreadhseet whose columns change each month. I want to automatically
delete all the columns in the spreadsheet ecept for the first and last
columns. Is there a way to do this automatically?