1

When the code inserts the data I need it to read like a paragraph. At present the data runs outside the printable page limits and disappears. I want it to find the range edge (column p) and restart at the next row, beginning again at Column K

If InStr(TextBox2.Value, " 5 ") Then
Dim lastRow As Long
lastRow = wsGroup.Cells(wsGroup.Rows.Count, "K").End(xlUp).Row + 1 ' Find the last row in column K
wsGroup.Range("K" & lastRow + 1).Value = wsSheet3.Range("G5").Value
End If

enter image description here

As you can see (hopefully) the data runs outside the field (columns k to p)

I'm not sure what to try next, any help, feedback or ideas appreciated

Cheers, Cmack

PeterT
  • 8,232
  • 1
  • 17
  • 38
Dill
  • 11
  • 2
  • Might be worth looking at this: https://stackoverflow.com/questions/5012465/vb-macro-string-width-in-pixel to find the length of text in pixels. If the length is larger than the width of the cells, then merge the cells and word wrap, from the length of of the text you should be able to determine the required height for the merged cells. – 5202456 Jun 20 '23 at 11:55

0 Answers0