View Single Post
 
Old 05-16-2022, 08:05 PM
dohertym dohertym is offline Windows 10 Office 2021
Novice
 
Join Date: May 2022
Posts: 6
dohertym is on a distinguished road
Default Formatting a calculated number - to be added to bookmark

Hi,

I have a userform which requires to the user to enter the number of kilometers travelled. On the word document the number of kms shows but also the cost (i.e. $0.85/km)

I've managed to do the code for this and it's working great. The only issue is that the amount that goes to the bookmarked place for the cost is showiong as 1 decimal place (It's $....).

Can someone please help me with the code I need to format the cost amount correctly?

Below is the code - it shows the number of Kms going to the bookmarked location for that in the document and the cost (once calculated) going to the bookmarked place for it.

Dim KMsTravelled As Range
Set NumberKMs = ActiveDocument.Bookmarks("NumberKms").Range
NumberKMs.Text = Me.KMsTravelled.Value

Dim KMsCost As Range
Set KMsCost = ActiveDocument.Bookmarks("KMsCost").Range
KMsCost.Text = Me.KMsTravelled.Value * 0.85


Thanks for your help
Reply With Quote