A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

VBA inserting chr(10) or vbLf



 
 
Thread Tools Display Modes
  #1  
Old May 10th, 2010, 11:03 AM posted to microsoft.public.excel.misc
Jack Sons
external usenet poster
 
Posts: 137
Default VBA inserting chr(10) or vbLf

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


  #2  
Old May 10th, 2010, 12:17 PM posted to microsoft.public.excel.misc
Ron Rosenfeld
external usenet poster
 
Posts: 3,719
Default VBA inserting chr(10) or vbLf

On Mon, 10 May 2010 12:03:40 +0200, "Jack Sons" wrote:

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
  #3  
Old May 10th, 2010, 12:26 PM posted to microsoft.public.excel.misc
BSc Chem Eng Rick
external usenet poster
 
Posts: 98
Default VBA inserting chr(10) or vbLf

Use the "replace" function
--
If this helps, please click "Yes"



"Jack Sons" wrote:

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


.

  #4  
Old May 10th, 2010, 12:47 PM posted to microsoft.public.excel.misc
Jack Sons
external usenet poster
 
Posts: 137
Default VBA inserting chr(10) or vbLf

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.
"BSc Chem Eng Rick" schreef in
bericht ...
Use the "replace" function
--
If this helps, please click "Yes"



"Jack Sons" wrote:

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


.



  #5  
Old May 10th, 2010, 12:49 PM posted to microsoft.public.excel.misc
Jack Sons
external usenet poster
 
Posts: 137
Default VBA inserting chr(10) or vbLf

Thanks Ron. It's a certaincy that Len(myCell) 15.

Jack.

"Ron Rosenfeld" schreef in bericht
...
On Mon, 10 May 2010 12:03:40 +0200, "Jack Sons" wrote:

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



  #6  
Old May 10th, 2010, 04:53 PM posted to microsoft.public.excel.misc
Ron Rosenfeld
external usenet poster
 
Posts: 3,719
Default VBA inserting chr(10) or vbLf

On Mon, 10 May 2010 13:49:53 +0200, "Jack Sons" wrote:

Thanks Ron. It's a certaincy that Len(myCell) 15.

Jack.


Glad to help.
--ron
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:04 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.