Hello all,
I know this is really an easy macro but I'm not quite sure how to get it written, still quite new to macros.
Anyways here is the situation, I have a cell on one sheet, C15 that contains several lines of text. On another sheet I want to transfer this text so it fits in range("J15:Q31"). This is what I have as a base.
Now here is the problem, the above code works great across the cells to but vertically i miss text.
Now I think i need to split the text cell C15 so i can spread it down several rows.
i'm not good at thinking of it but here is my idea. For each row, i discovered you can place 76 characters so i can split up the text in groups of 76. So somehow I would need it to count the letters in the string and once it it 76 it would look to see if the next character was a letter or space. If it was a letter then it would move backwards to the last space it past and cut the text there and place it in J16 which is Centered across J16:Q16. Then it would pick up from the the point it cut off and run down the next set of 76 characters and do the same with the next set of text and place it in J17 and so on until there was no more text to split. My range is from J16:Q31. If this is possible please help.
I know this is really an easy macro but I'm not quite sure how to get it written, still quite new to macros.
Anyways here is the situation, I have a cell on one sheet, C15 that contains several lines of text. On another sheet I want to transfer this text so it fits in range("J15:Q31"). This is what I have as a base.
Code:
Sub text()
Sheet2.Range("C15").Copy
With Sheet1.Range("J16:Q16")
.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
.horizontalalignment = xlCenterAcrossSelection.
End With
End Sub
Now here is the problem, the above code works great across the cells to but vertically i miss text.
Now I think i need to split the text cell C15 so i can spread it down several rows.
i'm not good at thinking of it but here is my idea. For each row, i discovered you can place 76 characters so i can split up the text in groups of 76. So somehow I would need it to count the letters in the string and once it it 76 it would look to see if the next character was a letter or space. If it was a letter then it would move backwards to the last space it past and cut the text there and place it in J16 which is Centered across J16:Q16. Then it would pick up from the the point it cut off and run down the next set of 76 characters and do the same with the next set of text and place it in J17 and so on until there was no more text to split. My range is from J16:Q31. If this is possible please help.
Last edited: