Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
BP BP is offline
external usenet poster
 
Posts: 13
Default Delete Columns

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 342
Default Delete Columns

What is the question?
  #3   Report Post  
Posted to microsoft.public.excel.programming
BP BP is offline
external usenet poster
 
Posts: 13
Default Delete Columns

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.



--
BP


"TomPl" wrote:

What is the question?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Delete Columns

THis will delete it on every worksheet

Dim WS as Worksheet

For Each WS in ActiveWorkbook.Worksheets
WS.Columns("AA:AY").Delete
Next WS
--
HTH,
Barb Reinhardt



"BP" wrote:

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.



--
BP


"TomPl" wrote:

What is the question?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Delete Columns

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



"BP" wrote:

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




  #6   Report Post  
Posted to microsoft.public.excel.programming
BP BP is offline
external usenet poster
 
Posts: 13
Default Delete Columns

Thanks but I need to specify different columns ranges on different worksheets
--
BP


"Barb Reinhardt" wrote:

THis will delete it on every worksheet

Dim WS as Worksheet

For Each WS in ActiveWorkbook.Worksheets
WS.Columns("AA:AY").Delete
Next WS
--
HTH,
Barb Reinhardt



"BP" wrote:

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.



--
BP


"TomPl" wrote:

What is the question?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Delete Columns

It's very much the same. See other reply.
--
HTH,
Barb Reinhardt



"BP" wrote:

Thanks but I need to specify different columns ranges on different worksheets
--
BP


"Barb Reinhardt" wrote:

THis will delete it on every worksheet

Dim WS as Worksheet

For Each WS in ActiveWorkbook.Worksheets
WS.Columns("AA:AY").Delete
Next WS
--
HTH,
Barb Reinhardt



"BP" wrote:

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.



--
BP


"TomPl" wrote:

What is the question?

  #8   Report Post  
Posted to microsoft.public.excel.programming
BP BP is offline
external usenet poster
 
Posts: 13
Default Delete Columns

Thank You!!! That worked great
--
BP


"Barb Reinhardt" wrote:

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



"BP" wrote:

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete columns if 0 jatman New Users to Excel 2 January 3rd 09 04:39 AM
create a macro to delete columns and then border remaining columns Jane777 Excel Programming 1 July 18th 07 12:08 AM
Delete all Columns with a certain value [email protected] Excel Programming 3 May 17th 07 02:41 AM
merge text from 2 columns into 1 then delete the old 2 columns sleepindogg Excel Worksheet Functions 4 March 30th 06 07:25 PM
Delete columns Scottmk[_32_] Excel Programming 8 September 3rd 04 01:11 AM


All times are GMT +1. The time now is 12:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"