LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Column Delete based on String

I'm desperately tring to delete a column if a cell within a range equals
"TESTING". Below gives error "Method 'Range' of Object '_Global' failed". I
also need this selection to auto set to A1 to last non-blank cell on row 1.
The cell coloring line works and is just there so I know I'm on the right
cell.

Any help in fixing these 2 actions may save a lot of gray hair.

Sub testSelectDelete()
Dim cell As Range

For Each cell In Selection
If Not IsEmpty(cell) And cell.Value = "TESTING" Then
cell.Interior.Color = RGB(255, 255, 192)
Range(cell).EntireColumn.Delete
End If
Next

End Sub


 
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
Copy column header to next column, delete & delete every nth colum genehunter New Users to Excel 1 June 2nd 09 03:57 PM
Create helper column which returns a text string based on multiplecriteria. Pierre Excel Worksheet Functions 3 March 28th 09 01:08 AM
Delete a string Joe Gieder Excel Worksheet Functions 5 October 3rd 08 07:39 PM
Code help, delete rows based on column criteria Stout Excel Discussion (Misc queries) 2 March 20th 07 01:17 PM
DELETE ROWS FROM XLS IF THE ROW CONTAINS THE STRING [email protected] Excel Discussion (Misc queries) 1 September 30th 06 01:21 PM


All times are GMT +1. The time now is 12:22 PM.

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

About Us

"It's about Microsoft Excel"