Count number of lines of text in a range/value.

To start,
1) Add a form w/ a textbox to your VBA project.
2) Set the textbox's AUTOSIZE property to False.
3) Set the textbox's MULTILINE property to False.

In your code...
4) Call on the Form's SHOW method (modal or modeless is irrelevant).
5) Set the textbox's TEXT property to the (trimmed) value you are
working with.
6) Set the textbox's AUTOSIZE property to True.
7) Set the textbox's MULTILINE property to True.
8) Save/get the textbox's LINECOUNT property.
9) Call on the form's HIDE method.

0
jacob2666 (5)
10/18/2005 7:23:33 PM
excel 39879 articles. 2 followers. Follow

1 Replies
629 Views

Similar Articles

[PageSpeed] 25

btw, I assume no responsibility for the code.  Use it at your own risk.
Please let me know if there is a better way to do this (ie w/o a form
and tbox).

0
jacob2666 (5)
10/18/2005 7:26:18 PM
Reply:

Similar Artilces:

spontaneously changed subject lines #2
Hi, A lot of our users experience problems with spontaneously 'changed' subject lines in Outlook. When sending an e-mail or planning an appointment the enter a subject line. Let say the original subject line they entered was: "Mail for you Boss" After sending the mail/appointment they found out that the subject line was changed in: "???????? Mail for you Boss, or "=E2=96=A1=E2=96=A1=E2=96=A1=E2=96=A1=E2=96= =A1=E2=96=A1=E2=96=A1=E2=96=A1 Mail for your Boss" or something else This happens every time they create/sent a new mail or change/view an existing mail. ...

How to get a long column of numbers to wrap and print on 1 page?
I have a long column of numbers that we add to daily. This column needs to be sorted in ascending order and then printed. I don't know of a way to sort multiple columns together so that is why it is one long column. Is there a way to get it to print as multiple columns across a page so as to not have numerous pages with only 1 column on each? Thanks. take a look here: http://www.mvps.org/dmcritchie/excel/snakecol.htm In article <3880FBB4-BF95-4A82-B98A-519C79BF1A34@microsoft.com>, Sue <Sue@discussions.microsoft.com> wrote: > I have a long column of numbers th...

Pivot table and counting.
I have a pivot table that gives me the number of rides done by a van. I can have the pivot table return the number of rides, but what I need is the number vans that participated for a certain day. Example, it is possible to have 27 trips done by 18 vans, how can I count the number of vans and not addup the van number? Any help appreciated. Thank you, Joe Hi Joe We need a bit more information on how your source data table is set up. What information do you have in each column? -- Regards Roger Govier sacredarms <sacredarms@discussions.microsoft.com> wrote: > I have a pi...

Cycle Counting
Hello, I am looking for ideas on how to cycle count serial number tracked items without increasing workload. Our serialized items are barcoded but the problem is the are situated on the pallet incorrectly and the pallet is placed on a third level of a racking system. If we could just cycle count based on item count and not include the serial number it would make it easy. Is this possible in Great Plains. We are running Great Plains 8.0. Any suggestions are greatly aprreciated. Thank You, Brian Morris Database Administrator ...

Import text file from MS Word into MS Publisher.
I have created a text file in Word and a photo file in Publisher and would like to merge the two. When I imported Word, it seemed to be totally separate from the Publisher document - 7 pages of Word and 8 pages of photos. I want the Word pages to precede the Publisher pages. How is this done? >-----Original Message----- >I have created a text file in Word and a photo file in Publisher and would >like to merge the two. When I imported Word, it seemed to be totally >separate from the Publisher document - 7 pages of Word and 8 pages of photos. > >I want the Word pages ...

Removiing decimals from an excel number
Here is the issue: I have numbers like this one - 10000.01.01.200 I just want the prime number 10000. How can I do that? I tried Ctrl+F and replace but is there a more efficient way? Thanks! =LEFT(A1,FIND(".",A1)-1) -- Gary''s Student - gsnu201001 "Data Analyst" wrote: > Here is the issue: I have numbers like this one - 10000.01.01.200 > > I just want the prime number 10000. How can I do that? I tried Ctrl+F and > replace but is there a more efficient way? > > Thanks! try this =LEFT(A1,FIND(".",A1,1)-1)...

Set RN = Range(Cells(2, 1), Cells(r, 1)) error
What wrong with this. It create error. How can I improve to get rid the error? Set RN = Range(Cells(2, 1), Cells(r, 1)) Thanks Daniel Hi Daniel, Too much missing information - has r been declared and what data type is it and what value does it have. What property of the range are you trying to store in the variable RN? What type of variable is RN and has it been declared. -- Thanks, Shane Devenshire "Daniel" wrote: > What wrong with this. It create error. How can I improve to get rid the > error? > > Set RN = Range(Cells(2, 1), Cells(r, 1)) > &...

Adding Text to Charts
I have created a chart in Excel that tracks one of the stock indexes. I have been able to point arrows to specific days and add text so I know what was the reason the stock index was up or down on that day. However, as my chart expands the arrows and text are no longer associated with those day I initially intended it for. Is there any way in Excel to associate text with specific day and have it attached so that if the chart grows or shrinks it will always be associated with that particular day. Thanks Hi Roy, The trick is to group the graphic element and the chart. When adding a graph...

Linking a defined range to a picture in PowerPoint
Hi, I know this is a long shot, but I'm hoping SOMEBODY has the answer.... I need to create a power point presentation that links to an excel workbook. The reason I need to link it is because the numbers will change monthly, and the presentation is distributed monthly. So, I need to create a presentation that will: 1) have excel worksheets in it that link to defined ranges in a workbook. 2) HOPEFULLY have the Pow.Pt. worksheet appear as a bitmap (if not thats ok) 3) allow the Pow.Pt. SS (or the picture) to link to the SS so that the image will change every month. I know it'...

Count
Hi, I would like to know how which formula I should use to count some codes & to ignore the duplicated codes, for example in column A: Code 1234 4321 4321 1234 1234 3214 Now, I want Excel to count & the result is 3 which are: 1234-4321-3214 Yes I can use PivotTable, but I would like to use a formula because I have to deal with this every day. I appreciate your support. -- MFS22 COUNTIF will do it. =COUNTIF(Rng,Rng), where the criterion is the same as the range: e.g =COUNTIF(A3:A8,A3:A8) HTH Peter "MFS" wrote: > Hi, > I wo...

Window's verson numbers
I'm writing an app in C++ using VS.net and I need to do this based on the OS. I can get the OS version number using _osver global variable found in the include STDLIB.H. But I need a list of what version number correspond to what OS so I know what the value in _osver means. Does anyone know where I can find these definitions? Also the major and minor builds might be useful? If this is the wrong newsgroup could you direct me to the right one? Thank Lots, Neil Neil B wrote: >I'm writing an app in C++ using VS.net and I need to do this based on the OS. >I can get the OS ver...

How do I count the # of times a value reoccurs and plot it over ti
I wish to plot a number of errors made by each users and compare it over time. I have a column of user ID's and a column of dates. I want the chart to count the number of times each user ID appears and plot against it's corresponding date. However, each time I try to do this, the chart appears wrong. Any ideas? In article <9595B2A1-8282-4AB3-8511-A6776E108164@microsoft.com>, Stephen@discussions.microsoft.com says... > I wish to plot a number of errors made by each users and compare it over > time. I have a column of user ID's and a column of dates. I want t...

Simple...Update Text Box in Chart
Hello, I have a chart in an MS Excel worksheet and I would like to change the value/caption of a textbox( Text Box 20). I have only been able to change the title of the chart with the following: With MyChart.Workbooks(1).Worksheets("Chart").ChartObjects(1).Chart .HasTitle = True .ChartTitle.Text = "Summary of Report" & date() 'Add Today's Date End With Do I have to reference the chart or do I have to reference the textbox itself? Hi, If the shape is actual embedded in the chart object then something like, ActiveChart.Shapes(&quo...

Line count
I am working with a program called Dictaphone. We use Word 2007 in this program. The line count on Dictaphone and the line count in Word 2007 are different even though the Dictaphone text is retrieved from Word 2007. Why would they be different? What is the difference between virutal line count and physical line count? ...

Read values from excel rows
hi I am trying to read the values from a excel row. There are 89 columns for each row and same number of data in each rows. Kindly help regards shantanu shantanu, You need to explain how/where you want to read them.... From another workbook, another worksheet, a VBA function, a macro, a C# application? HTH, Bernie MS Excel MVP "shantanu" <shantanusenin@gmail.com> wrote in message news:1184298794.259390.216180@i38g2000prf.googlegroups.com... > hi > I am trying to read the values from a excel row. There are 89 > columns for each row and same number of da...

Bold Grid Lines
I have a company expense form that has bold grid lines for all of the rows. I removed several of the rows last month and now have had to add them back but I cannot get the grid lines to show or print out as bold even though I have indicated that the grid lines should be printed. I am using Excel 2002 with SP2. Thanks for your help. Paul (ctunes) Select the range, format>cells>border Carlos "Ctunes" <Ctunes@discussions.microsoft.com> wrote in message news:0F20A454-A9D0-48C4-80D8-F36DD2B46826@microsoft.com... > I have a company expense form that has bold grid l...

Text to Columns 06-01-10
Hi. I have a column where I have names and surnames. I want to put name in one column and surname in anoter column. In order to do this, I use Text to Columns, but I have the following issue: if the cell contains for example Juan Pérez, it works ok, but when the cell contains Juan De los Santos, it assumes there are three surnames, and then put me one word in each column. This is the result, with the example mentioned: A B C D Juan Pérez Juan De los Santos How can I indicate that...

Multiply all query by same value
...

count number of characters in rich edit control
How can i count number of characters in rich edit control 2 If u mean controls of type Rich TextBox control, try RichControl1 RC1; CString Mes=RC.GetText(); int n=Mes.GetLength(); "Rahul" <Rahul@discussions.microsoft.com> wrote in message news:7743023C-EA83-4ACA-AB67-F1AE7279F1EB@microsoft.com... > How can i count number of characters in rich edit control 2 EM_GETTEXTLENGTHEX, WM_GETTEXTLENGTH, WM_GETTEXT, EM_STREAM* "Rahul" <Rahul@discussions.microsoft.com> wrote in message news:7743023C-EA83-4ACA-AB67-F1AE7279F1EB@microsoft.com... > How can i co...

getting rid of zero values in a column
i have a set of data on a column that i`ll use to plot on a graph and find a trendline for its behaviour...problem is: there is zero values in some cells that were not calculated... i want to copy this data in a new column getting rid of cells with zero value because it results in a wrong trendline...how can i do this?please help this is an example of what i mean: 1 1 3 3 4 4 0 6 6 3 3 1 0 0 0 1 One of the simpler ways is to hide the rows for the cells that have zeros and then plot the graph. "kafoury123" wrote: > i have a set of data on a ...

Extra Blank Lines
The following macro imports a text file and sorts horse races in time order and puts a blank line in between each race time (which is at the end of the code), which it does admirably. I had some valuable help with this project from group members recently. However, it does create quite a few blank lines en bloc. It's not really a problem, as I search them out and do a delete. Below is the code which a member might use in order to find the cause of the blank lines? Sub Macro1() Range("A2:J601").Select Selection.ClearContents Range("A2").Select ...

Counting sales
I have two different datasets. Each with a common identifier. I need a formula that will reference the identifiers in both datasets and count the number of sales a particular agent made. Example. look up this identifier in the other dataset and then give me the value that is 2 columns over from the identifier in the second dataset. See if this helps: http://contextures.com/xlFunctions02.html -- Biff Microsoft Excel MVP "Dave" <Dave@discussions.microsoft.com> wrote in message news:E7245B37-033F-400E-9CEE-9822BE7CB0F5@microsoft.com... >I have two...

Date range for a report
Hi I am trying to run a query and can't seem to nail down the right code. We use the access database to track files, incoming/outgoing correspondence dates etc. I am trying to run a query that show me files with dates in a follow up field of -60 days to +7 days, so essentially any follow ups missed in the last 2 months and up coming in the next week. This report is run on a weekly basis. Appreciate any help Thanks Assuming that the follow up field is actually a date/time data type, try this in the criteria: Between Date() - 60 and Date() + 7 -- Jerry Whittle, ...

subscript out of range error
My program went down with on error in the code. I fixed that error an tried to re-run it. When I go to re-run the program I get a subscrip out of range error when I try to open a worksheet that I know exists. If I close the workbook and re-open it the subscript out of range erro doesn't show up. Below is the code. With Worksheets("ListBox Data").Range("A2") workbook_row_cnt = Range(.Offset(0, 0) .End(xlDown)).Rows.Count For i = 0 To workbook_row_cnt - 1 If .Offset(i, 0) <> "" Then sales_group_cnt = sales_group_cnt + 1 End If Next i End With ...

COUNT ? need formula
Hi, I want to track the results of my teams sales performance. I record if it is a sale, no sale, cancelled etc in column M. I thought I'd be able to use the COUNT function/formula to be able to search for all the SALES in column M and place the result in a cell ( column O )but I can't work it out. Any ideas? Damian Hi! Try this: =COUNTIF(M1:M100,"sale") Biff "Diamond Jones" <kwanzaNOSPAM@optusnet.com.au> wrote in message news:43a0e897$0$17704$afc38c87@news.optusnet.com.au... > Hi, > > I want to track the results of my teams sales perf...