I'm building an extract in EXCEL. I've already asked a few questions about it, but as I continue to make progress, I also continue to face obstacles that prevent me from having it look professional. Here's what my extract is like...
I select date from SQL Server..
Select Location,Name, Q1, Comments
From tblInfo
Then I make headers for extract
With xlSheetInfo
.Cells(5, 1).ColumnWidth = 50
.Cells(5, 1).Value = "School"
.Cells(5, 2).ColumnWidth = 25
.Cells(5, 2).Value = "CLIENT NAME"
.Cells(5, 3).Value = "Q1"
.Cells(5, 4).Value="Comments"
End with
Then I populate it with data...using Recordset
While Not g_RS3.EOF
For i = xlCol To rCount
Cells(xlRow, xlCol).Value = g_RS3("School")
Cells(xlRow, xlCol).Font.Bold = True
xlCol = xlCol + 1
Cells(xlRow, xlCol).Value = g_RS3("LastName") & " ," & g_RS3("FirstName")
xlCol = xlCol + 1
Cells(xlRow, xlCol).Value = g_RS3("Q01")
xlCol = xlCol + 1
Cells(xlRow, xlCol).Value = g_RS3("Comments")
Cells(xlRow, xlCol).EntireColumn.AutoFit
xlrow = 1
g_rs3.movenext
Next i
Wend
The issue Icame across is in the Comments Section. The user is able to enter multiple lines/sentences of comments. What I'm seeing is that some users enter a comments, do a few line breaks, and enter another comment - for the same record. So if you look at the spreadsheet, it shows you these unnecessary spaces. In some cases the user will do a few line breaks, and then enter a comment, in this case it also looks unprofessional. I'm tyring to get rid of the spaces all together, so that if there are a few lines of comments, there one below another. Here's an image of what I'm talkin about ...
https://i.sstatic.net/T0dmS.png
I played around with RTrim, LTrim, Trim but it doesn't seem to work. Another thing is, i might have any values there (NULL). Any ideas ????
splitby line breaks?