Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 143
  • Last Modified:

Showing percentage of value in textbox

Hi
Does anyone know how I can return a % in a textbox based on a txtbox which changes from txtboxs which accepts numbers

Many Thanks
Andy
0
samandrew
Asked:
samandrew
1 Solution
 
PaulHewsCommented:
Assuming Text1 to receive Text2/Text3:
Option Explicit
 
Private Sub Command1_Click()
    If IsNumeric(Text2.Text) And IsNumeric(Text3.Text) Then
        If CDbl(Text3.Text) < 0.00001 Then
            ''Avoid divide by zero
            Text1.Text = "0"
        Else
            Text1.Text = Format(CDbl(Text2.Text) / CDbl(Text3.Text), "Percent")
        End If
    End If
End Sub

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now