starsky
10-20-2009, 08:50 AM
Hi,
I need to cleanse a range of data within columns L:R of certain text values. The code below does the job with two of those values, I was wondering what the most efficient way would be to complete this task with all half dozen plus values that will need to be deleted. I was thinking Select Case somehow?
Thanks.
Sub DelALML()
Dim Cl As Range
Dim LR As Range
Set LR = Range("L:R")
Application.ScreenUpdating = False
For Each Cl In LR.Cells
If Cl.Value = "Annual Leave (AL)" Or Cl.Value = "Maternity Leave (ML)" Then
Cl.ClearContents
End If
Next Cl
Application.ScreenUpdating = True
End Sub
I need to cleanse a range of data within columns L:R of certain text values. The code below does the job with two of those values, I was wondering what the most efficient way would be to complete this task with all half dozen plus values that will need to be deleted. I was thinking Select Case somehow?
Thanks.
Sub DelALML()
Dim Cl As Range
Dim LR As Range
Set LR = Range("L:R")
Application.ScreenUpdating = False
For Each Cl In LR.Cells
If Cl.Value = "Annual Leave (AL)" Or Cl.Value = "Maternity Leave (ML)" Then
Cl.ClearContents
End If
Next Cl
Application.ScreenUpdating = True
End Sub