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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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,215,429
Messages
6,124,834
Members
449,192
Latest member
mcgeeaudrey

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