ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   delete two columns at a time (https://www.excelbanter.com/excel-programming/376084-delete-two-columns-time.html)

John Smith

delete two columns at a time
 
In my script, I delete two columns one by one using the following
two lines of code:

.Columns(1).EntireColumn.Delete
.Columns(1).EntireColumn.Delete

Can one command do the job instead of two? Thanks.

Tom Ogilvy

delete two columns at a time
 
..Columns(1).Resize(,2).EntireColumn.Delete

--
Regards,
Tom Ogilvy


"John Smith" wrote in message
...
In my script, I delete two columns one by one using the following
two lines of code:

.Columns(1).EntireColumn.Delete
.Columns(1).EntireColumn.Delete

Can one command do the job instead of two? Thanks.




Jim Cone

delete two columns at a time
 
All of these work and there are more available...
Columns("A:B").Delete
Range("A1:B1").EntireColumn.Delete
Range(Columns(1), Columns(2)).Delete
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"John Smith"

wrote in message
two lines of code:
.Columns(1).EntireColumn.Delete
.Columns(1).EntireColumn.Delete
Can one command do the job instead of two? Thanks.


All times are GMT +1. The time now is 01:17 PM.

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