Using .Replace

  • Thread starter Thread starter Jason Morin
  • Start date Start date
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
 
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
 
Hi Bernie

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top