ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can I Atomatically Split Cell Contents (https://www.excelbanter.com/excel-programming/387512-can-i-atomatically-split-cell-contents.html)

LongTermNoob

Can I Atomatically Split Cell Contents
 
I am currently using a workbook to assist in filling out several forms by
using only one input form. My problem is that two of the fields can contain a
lot of text and only the first 1024 will display.

Is there code that will count the characters and, if required, split them
over two cells?

TIA

Gary''s Student

Can I Atomatically Split Cell Contents
 
Say A1 contains a very large volumn of text. This macro:

Sub fracture()
s = Split(Range("a1").Value, " ")
i = 1
t = ""
For j = 0 To UBound(s)
t = t & s(j) & " "
If Len(t) 1000 Or j = UBound(s) Then
Cells(i, "B").Value = t
t = ""
i = i + 1
End If
Next
End Sub


will take that text and distribute it into B1,B2,B33,..... with about 1000
characters in each cell.
--
Gary''s Student - gsnu200715


LongTermNoob

Can I Atomatically Split Cell Contents
 
Thanks for this, but it doesn't seem to work. Of course this may be because I
failed to mention that the cell containing the text is a merged cell. Is ther
any way around it?

Just to be sure I'm not altering anything I shouldn't - the text is in E12
(E12:R12 merged) and i need it to drop down to the following rows.

Thanks

"Gary''s Student" wrote:

Say A1 contains a very large volumn of text. This macro:

Sub fracture()
s = Split(Range("a1").Value, " ")
i = 1
t = ""
For j = 0 To UBound(s)
t = t & s(j) & " "
If Len(t) 1000 Or j = UBound(s) Then
Cells(i, "B").Value = t
t = ""
i = i + 1
End If
Next
End Sub


will take that text and distribute it into B1,B2,B33,..... with about 1000
characters in each cell.
--
Gary''s Student - gsnu200715



All times are GMT +1. The time now is 02:28 AM.

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