Solved

In VBA, add a decimal after the 5th digit of a number.

Posted on 2007-11-29
4
441 Views
Last Modified: 2013-11-28
I have a number, like this, "394154616203704" and I need to place a decimal after the 5th digit, like this: 39415.4616203704
There can be a varying amount of digits after the decimal.   I need to do this in VBA to a number that is in a text box.

I have been playing with the Format function but can't seem to get it right. I greatly appreciate your help.

Thank you!
JA67

Open in new window

0
Comment
Question by:JA67
  • 2
  • 2
4 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 20374786
try  using the left and mid function, do you have to save this as number or text

left("394154616203704",5)&"."&mid("394154616203704",6)

or
left(me.textname,5)&"."&mid(me.textname,6)
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 20374877
or
cdbl(left(me.textname,5)&"."&mid(me.textname,6))
0
 

Author Comment

by:JA67
ID: 20374992
Thank you!  That works great! I am going to store the this as a number.
0
 

Author Closing Comment

by:JA67
ID: 31411700
I have received excellent help from capricorn1 on many occassions!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now