Good morning,
I modified the code accordingly and got another "Run-Time error 1004 - Unable to set the RowHeight property of the range class" on the code below.
Also, please look at the spreadsheet attachment. Is there any way I can get rid of the spacing(gap) that separates the line of text in the "Comment" field? - gap between each line of text is too much and I want it to be closer. See spreadsheet attachment
Code that caused Runtime error:
.RowHeight = .RowHeight * Len(xlWksht.Range("A" & CStr(ii + 1)).text) / w
or
.RowHeight = .RowHeight * Len(xlWksht.Range("A" & ii + 1).text) / w
Below is my entire module:
For Each R In xlWksht.Range("A8:h8"): w = w + R.ColumnWidth: Next
Do Until rsin.EOF = True
ii = ii + 2
xlWksht.Cells(ii, 1).Value = rsin![Req No]
xlWksht.Cells(ii, 2).Value = rsin![Description]
xlWksht.Cells(ii, 3).Value = rsin![P L] & Chr(10) & rsin![Pgmr2] & Chr(10) & rsin![Pgmr3]
xlWksht.Cells(ii, 4).Value = rsin![ClientName] & Chr(10) & rsin![Status]
xlWksht.Cells(ii, 5).Value = "-" & Chr(10) & rsin![Per Hrs]
xlWksht.Cells(ii, 6).Value = rsin![Hours] & Chr(10) & rsin![Tot Hrs]
xlWksht.Cells(ii, 7).Value = rsin![Start Date] & Chr(10) & rsin![Start Date]
xlWksht.Cells(ii, 8).Value = rsin![End Date] & Chr(10) & rsin![End Date]
xlWksht.Cells(ii + 1, 1).Value = "Comments:" & Chr(10) & "'" & rsin![Comments]
With xlWksht.Range(Cells(ii + 1, 1), Cells(ii + 1, 8))
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.WrapText = True
.Orientation = 0
.IndentLevel = 0
.MergeCells = True
.RowHeight = .RowHeight * Len(xlWksht.Range("A" & CStr(ii + 1)).text) / w
End With
rsin.MoveNext
Loop
Thanks,
tgifgemini