Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What is the question?
|
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
delete columns if 0 | New Users to Excel | |||
create a macro to delete columns and then border remaining columns | Excel Programming | |||
Delete all Columns with a certain value | Excel Programming | |||
merge text from 2 columns into 1 then delete the old 2 columns | Excel Worksheet Functions | |||
Delete columns | Excel Programming |