ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro - trailing blanks (https://www.excelbanter.com/excel-programming/276063-macro-trailing-blanks.html)

Dennis Griffith

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"?


All times are GMT +1. The time now is 04:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com