View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dennis Griffith Dennis Griffith is offline
external usenet poster
 
Posts: 1
Default Macro - trailing blanks

I am trying to write concatenated individual cells as a record to a
file but it is trimming the trailing blanks in the cell. This is the
code I have:

For RowNdx = StartRow To EndRow
WholeLine = ""
For ColNdx = StartCol To EndCol
CellValue = (Cells(RowNdx, ColNdx).Value)
WholeLine = WholeLine & CellValue
Next ColNdx
Print #FNum, WholeLine
Next RowNdx

If cell1 = "Test " and cell2 = "This ". The result in the file is a
record with "TestThis". How can I get it to write the record as
"Test This"?