View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
david mcritchie david mcritchie is offline
external usenet poster
 
Posts: 691
Default How can I insert a space before the last character in a range of cells

Hi Jeff,
Assume these are for text and not numbers.
SpecialCells is an automatic limitation to the used range,
in addition limited to text constants in the following.
(untested code)

Sub Jeff_space()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim Cell as Range
On Error Resume Next 'In case no cells in selection
For Each Cell In Intersect(Selection, _
Selection.SpecialCells(xlConstants, xlTextValues))
if length(cell.value) 0 then
cell.value = left(cell.value,length(cell.value)) & " " & right(cell.value)
end if
Next
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

More information on the extra coding in
http://www.mvps.org/dmcritchie/excel/proper.htm
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Jeff" wrote in message ...
Any help greatly appreciated!

Jeff
MCP 70-215