Hi
I hope you can help me. The following macro works but it also deletes columms that partly contains the string its searching for.
So if a columm is called procesnavn it also deletes the columm. How can I alter the macro so it only deletes a columms if it's a 100 % match?
Thanks in advanced.
Kind regards
Thomas
I hope you can help me. The following macro works but it also deletes columms that partly contains the string its searching for.
Code:
'Sub Remove_columns()
' Dim wS As Worksheet
' For Each wS In ThisWorkbook.Worksheets
' With wS
' For i = .Columns.Count To 1 Step -1
' If InStr(1, LCase(.Cells(1, i)), LCase("Cprnr")) Then .Columns(i).EntireColumn.Delete
' If InStr(1, LCase(.Cells(1, i)), LCase("Cvrnr")) Then .Columns(i).EntireColumn.Delete
' If InStr(1, LCase(.Cells(1, i)), LCase("Navn")) Then .Columns(i).EntireColumn.Delete
' Next i
' End With 'wS
' Next wS
'End Sub
So if a columm is called procesnavn it also deletes the columm. How can I alter the macro so it only deletes a columms if it's a 100 % match?
Thanks in advanced.
Kind regards
Thomas