VBA inserting chr(10) or vbLf

J

Jack Sons

Hi all,

In a for next loop I want to insert at a certain position (below it is
position 15) in a cell chr(10) (is that called a line feed?) to put the rest
of the content on a new line in the cell.
I tried

myCell.Characters(15) = vbLf

but that will not work.

What should the code be?

Thanks in advance for your advice.

Jack Sons
The Netherlands
 
R

Ron Rosenfeld

Hi all,

In a for next loop I want to insert at a certain position (below it is
position 15) in a cell chr(10) (is that called a line feed?) to put the rest
of the content on a new line in the cell.
I tried

myCell.Characters(15) = vbLf

but that will not work.

What should the code be?

Thanks in advance for your advice.

Jack Sons
The Netherlands


Left(myCell.Value, 15) & vbLf & Mid(myCell.Value, 15 + 1)

You may or may not want to test to see if Len(myCell) > 15

--ron
 
J

Jack Sons

Thanks Rick,

I'm afraid your suggestion will not work because it is unknown what
character we have on position 15. We know only its position.

Jack.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top