Solved

Showing percentage of value in textbox

Posted on 2007-11-23
1
136 Views
Last Modified: 2013-12-25
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
Comment
Question by:samandrew
1 Comment
 
LVL 38

Accepted Solution

by:
PaulHews earned 250 total points
ID: 20340159
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

749 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