Solved

How to count characters in a variable

Posted on 2001-07-16
3
163 Views
Last Modified: 2012-06-22
Could anyone let me know a simple way of counting the number of characters within a variable including spaces, i.e variable x contains text "hello i need a count:" therefore variable y = 21.
0
Comment
Question by:dustybryn
  • 2
3 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 6286031
?Len(x)

This will return 21.

0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6286036
To expand a little:

Dim x As String
Dim y As String
x = "hello i need a count:"
y = Len(x)
Msgbox "The Following Text: " & vbLF & x & vbLF & "Has " & CStr(y) & " Characters In It."
0
 

Author Comment

by:dustybryn
ID: 6286051
Cheers Tim. I know the question is dead basic but I haven't been in this game long and have had no training! I appreciate the rapid response.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MS Access Search and Replace Using VBA 6 70
Sending a email via excel using vba 6 80
Spell Check in VB6 13 112
Formula problem with Excel attachment 6 26
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

774 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question