Count Line Feed

mrroland

Active Member
Joined
Apr 29, 2002
Messages
294
Hi,

is it possible to count the number of times a line feed (alt - enter) is used in a text string

for example the count of the following example would be four
Book1
ABCD
1the quick brown fox jumps over the lazy dog the quick brown fox jumps over the lazy dog the quick brown fox jumps over the lazy dog
Sheet1



Cheers,
Roland
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Brilliant!

Thanks Richard

I was actually looking for a VBA solution. I guess i can store this temporarily in xl and then delete it afterwards. That would be ok

Hope i don't ask to much but is there any way i can detect this in VBA without entering the formula on the actual sheet

Cheers,
Roland
 
Upvote 0
Hi Roland

Sure - you can use the same principle:

Code:
Dim iNum As Integer
iNum = len(Sheets("Sheet1").Range("A1").Value)-len(replace(Sheets("Sheet1").Range("A1").Value,chr$(10),""))
 
Upvote 0

Forum statistics

Threads
1,214,786
Messages
6,121,553
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top