Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
Complex if test program possible? If "value" "value", paste "value" in another cell? | Excel Discussion (Misc queries) |