Delete Columns

  • Thread starter Thread starter BP
  • Start date Start date
B

BP

I have a workbook with multiple worksheets. I want to delete certain columns
from each worksheet and then save as a new workbook.

Ex:
Worksheet 1: delete columns aa:ay
Worksheet 2: delete columns Z:BD
 
Sorry I am new to VB and I forgot the code:

I am trying to cycle thru the worksheets and remove certain columns.

I tried this and get a delete method of range class error

ActiveWorkbook.Worksheets("Sheet1").Select
Worksheet.Columns("AA:AY").Delete Shift:=xlToLeft

Any help would be appreciated.
 
THis will delete it on every worksheet

Dim WS as Worksheet

For Each WS in ActiveWorkbook.Worksheets
WS.Columns("AA:AY").Delete
Next WS
 
ThisWorkbook.Worksheets("Sheet1").Columns("AA:AY").Delete
ThisWorkbook.Worksheets("Sheet2").Columns("Z:BD").Delete
 
Thank You!!! That worked great
--
BP


Barb Reinhardt said:
ThisWorkbook.Worksheets("Sheet1").Columns("AA:AY").Delete
ThisWorkbook.Worksheets("Sheet2").Columns("Z:BD").Delete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top