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

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

mrroland

Active Member
Joined
Apr 29, 2002
Messages
294
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
 

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
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),""))
 

Forum statistics

Threads
1,136,926
Messages
5,678,606
Members
419,775
Latest member
joh93

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
Top