View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default VBA for All cells in workbook

Sub liminal()
Dim c As Range
For Each sh In ThisWorkbook.Sheets
For Each c In sh.UsedRange
If c.Formula = "=TRIM(SUBSTITUTE(" & _
c.Address(False, False) & ",CHAR(160),CHAR(32)))" Then
c = c.Value
End If
Next
Next
End Sub




"Curt" wrote in message
...
I would like a VBA that replaces every cell of every sheet in a workbook
with
its output when used with the following function:

=TRIM(SUBSTITUTE(A1,CHAR(160),CHAR(32)))

thanks

Curt J