bradh_nz
07-30-2007, 07:11 AM
Hi, I have the following macro trying to delete all columns in a sheet that does not contain the following headings however it needs to run through 3 or four times to just end up with these 9 columns.
Any help appreciated
Sub DeleteThisColumn()
Dim ThisColumn As Range
For Each ThisColumn In Range(Range("a1"), Range("IV1").End(xlToLeft))
If ThisColumn <> "Process Cluster" Or _
ThisColumn <> "Process SBU" Or _
ThisColumn <> "Control Cluster" Or _
ThisColumn <> "P - Process Name" Or _
ThisColumn <> "P - Process Owner" Or _
ThisColumn <> "P - Risk Classification" Or _
ThisColumn <> "C - Control Name" Or _
ThisColumn <> "C - Workstream" Or _
ThisColumn <> "C - Application Supporting ABC" Then
ThisColumn.EntireColumn.Delete
End If
Next ThisColumn
End Sub
Any help appreciated
Sub DeleteThisColumn()
Dim ThisColumn As Range
For Each ThisColumn In Range(Range("a1"), Range("IV1").End(xlToLeft))
If ThisColumn <> "Process Cluster" Or _
ThisColumn <> "Process SBU" Or _
ThisColumn <> "Control Cluster" Or _
ThisColumn <> "P - Process Name" Or _
ThisColumn <> "P - Process Owner" Or _
ThisColumn <> "P - Risk Classification" Or _
ThisColumn <> "C - Control Name" Or _
ThisColumn <> "C - Workstream" Or _
ThisColumn <> "C - Application Supporting ABC" Then
ThisColumn.EntireColumn.Delete
End If
Next ThisColumn
End Sub