Solved

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

Posted on 2007-11-29
4
483 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
[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
  • 2
  • 2
4 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

734 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