ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   delete multiple columns with one line? (https://www.excelbanter.com/excel-programming/276000-delete-multiple-columns-one-line.html)

Bruce Roberson

delete multiple columns with one line?
 
Is there a way to replace this:

With Worksheets("Dif_data")
Columns("G:G").Delete
Columns("O:O").Delete
Columns("AB:AC").Delete
End With

With something shorther like:

Columns("G:G, P:P, AD:AE").Delete

(Doesn't work like this because I get this type mistmatch
error 13)



Chip Pearson

delete multiple columns with one line?
 
Bruce,

Try

Range("G:G, P:P, AD:AE").Delete


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"Bruce Roberson" wrote in message
...
Is there a way to replace this:

With Worksheets("Dif_data")
Columns("G:G").Delete
Columns("O:O").Delete
Columns("AB:AC").Delete
End With

With something shorther like:

Columns("G:G, P:P, AD:AE").Delete

(Doesn't work like this because I get this type mistmatch
error 13)





Bruce Roberson

delete multiple columns with one line?
 
That works. Thanks for the assistance.

Bruce
-----Original Message-----
Bruce,

Try

Range("G:G, P:P, AD:AE").Delete


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"Bruce Roberson" wrote in

message
...
Is there a way to replace this:

With Worksheets("Dif_data")
Columns("G:G").Delete
Columns("O:O").Delete
Columns("AB:AC").Delete
End With

With something shorther like:

Columns("G:G, P:P, AD:AE").Delete

(Doesn't work like this because I get this type

mistmatch
error 13)




.



All times are GMT +1. The time now is 08:45 AM.

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