Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Look for a value and clear it
I'm trying to find anything in column 9 that = "-//200-" and clear it.
Why does this not work? iEnd = ws.Cells(65536, 9).End(xlUp).Row Set rng = ws.Range(ws.Cells(3, 9), Cells(iEnd, 9)) For Each c In rng If InStr(c, "-//200-") = False Then c.Clear Next c Thanks, -- Dan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Look for a value and clear it
oops, that should be:
iEnd = ws.Cells(65536, 9).End(xlUp).Row Set rng = ws.Range(ws.Cells(3, 9), Cells(iEnd, 9)) For Each c In rng If InStr(c, "-//200-") = True Then c.Clear Next c |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Look for a value and clear it
Change
If InStr(c, "-//200-") = True Then c.Clear to If InStr(c, "-//200-") 0 Then c.Clear True has a numeric value of -1, and InStr returns 0 or a positive integer indicating the position at which the string was found. It will never return -1. For example Dim P As Integer P = InStr(1, "ABC", "B") Debug.Print "P = True: " & (P = True), "P = " & P You'll see that P is not equal to True. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Dan R." wrote in message ups.com... oops, that should be: iEnd = ws.Cells(65536, 9).End(xlUp).Row Set rng = ws.Range(ws.Cells(3, 9), Cells(iEnd, 9)) For Each c In rng If InStr(c, "-//200-") = True Then c.Clear Next c |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Look for a value and clear it
Excellent. Thanks Chip, I appreciate the explanation.
-- Dan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Transfer a name from one cell to another but leave clear if clear? | Excel Worksheet Functions | |||
Why Doesn't it Clear?? | Excel Discussion (Misc queries) | |||
clear the clear the web page email attachment lines | Excel Discussion (Misc queries) | |||
Not clear | Excel Discussion (Misc queries) | |||
Is there any way we cna clear everything.. | Excel Programming |