Thursday, July 22, 2010

How to convert multiple spaces to one space in cells

Software Environment
Version: 4.0.2
Edition: Excel

Effect image

Example code


<SelectRange(,"Sheet1","Book1.xls")>
$Address$="A1"

For(5)
$Value$=<ReadCell($Address$)>
$Value$=<TextStripWS($Value$,"Mid")>
<WriteCell($Value$,$Address$)>

$Address$=<RowAddress($Address$)>
Next


Code explanation
$Address$; Save cell address.
$Value$; Save the value need to be processed.

The For loop convert multiple spaces to one space in every cell.