ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Range of Columns (https://www.excelbanter.com/excel-programming/433893-re-delete-range-columns.html)

Chip Pearson

Delete Range of Columns
 
Try something like the following:

Dim R As Excel.Range
Set R = Range("F1")
Do Until Application.CountA(R.EntireColumn) = 0
Set R = R(1, 2)
Loop
' the empty column will be delete with the other cols.
' to leave the blank column in place, uncomment the
' next line:
'Set R = R(1, 0)

Range(Range("F1"), R).EntireColumn.Delete


This will delete columns from F to the next empty column. That empty
column will be delete with the others. To leave the empty column
intact, uncomment the Set R = R(1,0) line of code.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Mon, 21 Sep 2009 08:13:01 -0700, James
wrote:

can you please show me how to delete the entire column starting in column f
until an empty column is encountered. thanks.



All times are GMT +1. The time now is 10:24 AM.

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