[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

comma function for textbox

Posted on 2006-07-20
3
Medium Priority
?
300 Views
Last Modified: 2010-05-18
Hi,

Please assist how can we create a sub that will change the data inside a textbox to place a comma, like how the currency works?

i.e.
Text1.Text=350000
CommaText(Text1.Text,True)

Result:
Text1.Text=350,000

CommaText(textbox name, True to place comma or False to remove comma)

Thanks.
0
Comment
Question by:RyanBank
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Accepted Solution

by:
cquinn earned 1800 total points
ID: 17146795
Function CommaText(sValue as string, bToggle as boolean) as String

if bToggle then
  CommaText=Format(sValue, "##,##0")  
else
  CommaText=Format(sValue, "####0")  
end if

End Function
0
 

Author Comment

by:RyanBank
ID: 17146831
Will that also work if the value was more than a thousand? 1,000,000
0
 
LVL 9

Assisted Solution

by:dancebert
dancebert earned 200 total points
ID: 17147014
Works on any size input:
? Format(10000000000000000, "##,##0")  
10,000,000,000,000,000
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

656 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