View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default Help with Type Mismatch error please

Do you have a chart sheet? Maybe try

Sub Search_And_Replace_to_Activate()

For Each sht In ActiveWorkbook.Worksheets
For Each cell In sht.UsedRange.Cells
cell.Value = Replace(cell.Value, "a=", "=", 1, 1, vbTextCompare)
Next cell
Next sht
End Sub


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"shhhhh" wrote in message
...
Could someone please explain to me why it is that after the below code
runs I always get a Type Mismatch error once it actually finishes? Also,
any idea why it would run substantially faster if the workbook name is a
number than a name?

Sub Search_And_Replace_to_Activate()

For Each sht In ActiveWorkbook.Sheets
For Each cell In sht.UsedRange.Cells
cell.Value = Replace(cell.Value, "a=", "=", 1, 1, vbTextCompare)
Next cell
Next sht
End Sub


Thanks


--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-