View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
tod tod is offline
external usenet poster
 
Posts: 114
Default Apply expression to entire range

Here's an easy one for somebody.

My code currently cycles through a column in a worksheet
and removes unwanted characters, like this:

For Each Cell In mySheet.Range("A2:A" & mySheet.Range
("A65536").End(xlUp).Row)
If Left(Cell, 1) = "=" Or _
Left(Cell, 1) = "-" Or _
Left(Cell, 1) = "+" Or Then
Cell.Value = "'" & Cell.Value
End If
Next Cell

Problem is that if the worksheet has several thousand
records this code could take minutes. Is there a way to
apply this to the entire range at once instead of cycling
the range?

tod