Thread: Delete columns
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Delete columns

In case the first sheet is not named "Sheet1":

Sub delCol()
Sheets(1).Columns("A:AS").Delete
End Sub

There is no need to test for the number of sheets since you only want to
execute on sheet one. The Shift:=xlToLeft is the default so that is
unnecessary in this case. You would need the Shift parameter if you want to
shift right. Using the Sheet index number 1 picks the first sheet tab on the
left as it appears in the window view, so if that is not the Sheet1 you want
then you would have to specify the sheet name or its index number. This
might be more than you wanted to know.

"iperlovsky" wrote:

Would someone be able to provide guidance on how to write a routine to delete
columns A through AS in Sheet 1 only in a 3-Sheet workbook?