ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting Columns (https://www.excelbanter.com/excel-programming/304538-deleting-columns.html)

Jim Berglund

Deleting Columns
 
Why don't these work? (numberof Columns is properly defined)

Range.(Column(numberofColumns + 3),Column(numberofColumns + 17)).Select
Selection.Delete Shift:=xlToLeft



Columns(numberofColumns + 3, numberofColumns + 17).Select
Selection.Delete Shift:=xlToLeft

What should I do, instead?

Thanks.

Jim Berglund

Bob Phillips[_6_]

Deleting Columns
 
Jim,

You could try

Range(Cells(numberofColumns + 3, 1), Cells(numberofColumns + 17, 1)).EntireColumn.Delete


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jim Berglund" wrote in message ...
Why don't these work? (numberof Columns is properly defined)

Range.(Column(numberofColumns + 3),Column(numberofColumns + 17)).Select
Selection.Delete Shift:=xlToLeft



Columns(numberofColumns + 3, numberofColumns + 17).Select
Selection.Delete Shift:=xlToLeft

What should I do, instead?

Thanks.

Jim Berglund

Tom Ogilvy

Deleting Columns
 
Just a couple of typos (or possibly syntax errors)

Range(Columns(numberofColumns + 3),Columns(numberofColumns + 17)).Select
Selection.Delete Shift:=xlToLeft

or
Range(Columns(numberofColumns + 3),Columns(numberofColumns + 17)) _
.Delete Shift:=xlToLeft
without selecting.
--
Regards,
Tom Ogilvy


"Jim Berglund" wrote in message
...
Why don't these work? (numberof Columns is properly defined)

Range.(Column(numberofColumns + 3),Column(numberofColumns + 17)).Select
Selection.Delete Shift:=xlToLeft



Columns(numberofColumns + 3, numberofColumns + 17).Select
Selection.Delete Shift:=xlToLeft

What should I do, instead?

Thanks.

Jim Berglund




All times are GMT +1. The time now is 03:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com