Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 141
  • 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

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.

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