Using .Replace

J

Jason Morin

How can I find and replace for a certain range? I'd
rather not use Cells.Replace.... and search the entire
sheet:

Sub Worksheet_Activate()
Set area = Sheets("Layout-Bulk (2)").Range("A7:BR53")
For Each cell In area
.Replace What:="##", Replacement:="="
Next cell
End Sub

Thx.
Jason
 
B

Bernie Deitrick

Jason,

It is a bad idea to use variables that are used within the Object Model
(area is one)

Dim myArea As Range
Set myArea = Sheets("Layout-Bulk (2)").Range("A7:BR53")
myArea.Replace ....

HTH,
Bernie
MS Excel MVP
 
L

Leo Heuser

Hi Bernie

"Area" is OK to use. It's not used in the object model.
I believe you mean "Areas".
 
Top