Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Range of Columns Jacob Skaria Excel Programming 0 September 21st 09 04:22 PM
Delete & Merge Columns,Delete Rows with filter, etc traderindia Excel Programming 1 July 16th 09 08:17 PM
create a macro to delete columns and then border remaining columns Jane777 Excel Programming 1 July 18th 07 12:08 AM
Delete columns of a cell range Brettjg Excel Discussion (Misc queries) 2 April 25th 07 11:26 AM
Delete Columns For A Range scott Excel Programming 2 January 21st 05 11:39 PM


All times are GMT +1. The time now is 05:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"