Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Column Containing String
I'm deleting a column if a cell contains the variable "sString" below. How
can I modify this sub so it will find the string in a cell even if it has other characters in the cell besides "sString"? Basically, I need to check if "sString" is in a cell, regardless of other words or spaces. any help? Sub DeleteColumnswString(ByVal sString As String) Dim LastCol As Long Dim r As Long LastCol = Range("IV1").End(xlToLeft).Column Application.ScreenUpdating = False For r = LastCol To 1 Step -1 If Application.CountIf(Columns(r), sString) < 0 _ Then Columns(r).Delete Next r Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy column header to next column, delete & delete every nth colum | New Users to Excel | |||
Delete a string | Excel Worksheet Functions | |||
DELETE ROWS FROM XLS IF THE ROW CONTAINS THE STRING | Excel Discussion (Misc queries) | |||
Column Delete based on String | Excel Programming | |||
Delete characters from a string | Excel Programming |