View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Empty a cell if the values equal to "IN" , "MC" or "PP"

here is one way, just change the sheet reference:

Option Explicit

Sub empty_some_cells()
Dim ws As Worksheet
Dim lastrow As Long
Dim cell As Range
Dim rng As Range
Application.ScreenUpdating = False
Set ws = Worksheets("Sheet1")
lastrow = ws.Cells(Rows.Count, "B").End(xlUp).Row
Set rng = ws.Range("B1:B" & lastrow)
For Each cell In rng
Select Case cell.Value
Case "IN", "MC", "PP"
cell.Value = ""
End Select
Next
Application.ScreenUpdating = True
End Sub



--


Gary


"YHT" wrote in message
...
Hi all,

Could someone tell me how to write a script to empty a cell if the current
cell value is equal to "IN", "MC" or "PP"? I need to search from first cell
in Column B till the last cell in the same column.

Thanks.