ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting/Replacing Values in a Range (https://www.excelbanter.com/excel-programming/274606-deleting-replacing-values-range.html)

Dan Gesshel

Deleting/Replacing Values in a Range
 
Hello.

I am trying to delete (or replace with nothing) values in a range. For
example, the word "Blank" in the following range I am using:

sInput.Range("Y22:Y200").Replace What:="Blank", Replacement:="",
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

This works, but is there a better way of writing this... or perhaps
something more efficient? I don't have to necessarily use replace, as
deleting these values would suffice. Any help would be appreciated.

Thanks.

Dan



kiat

Deleting/Replacing Values in a Range
 
oops, clear method may be a tad too efficient, everything will be clear in
the range. So, Replace method is a better deal.

"kiat" wrote in message
...
How about Range("Y22:Y200").clearcontents

You may check out Object Browser and find out more on the various Clear
methods for object Range. Another way is press the key F1 in the code and
see what you'll find.


"Dan Gesshel" wrote in message
...
Hello.

I am trying to delete (or replace with nothing) values in a range. For
example, the word "Blank" in the following range I am using:

sInput.Range("Y22:Y200").Replace What:="Blank", Replacement:="",
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

This works, but is there a better way of writing this... or perhaps
something more efficient? I don't have to necessarily use replace, as
deleting these values would suffice. Any help would be appreciated.

Thanks.

Dan







Wild Bill[_2_]

Deleting/Replacing Values in a Range
 
..clearcontents and .clear wipe out the whole range.

I can't imagine anything more efficient than what you first came up
with, for the selective processing you indicate.


All times are GMT +1. The time now is 02:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com