Search: | |||||

| ||||

Home » Forum » MS Office | RSS Feeds |

I am very green with VB and I've created a button that when it's

clicked, it will display results of the entered data in a box on the

screen. What I am having an issue with is displaying the data in the

correct format. I want to display StdDeviation and SigmaM as .0123

but it shows as 1.233339388. Also I want all of the others to be no

longer than 4 decimal places. How do I specify this in the code?

Thanks in advance for any assistance you may be able to offer!

Snow

Private Sub CommandButton1_Click()

Calc

RunSummaryForm.AverageRun12 = Worksheets("Sheet1").Cells(19, 8)

RunSummaryForm.Run1Average = Worksheets("Sheet1").Cells(18, 7)

RunSummaryForm.Run2Average = Worksheets("Sheet1").Cells(18, 8)

RunSummaryForm.DeltaAverage = Worksheets("Sheet1").Cells(19, 6)

RunSummaryForm.SigmaM = Worksheets("Sheet1").Cells(20, 8)

RunSummaryForm.MaxDelta = Worksheets("Sheet1").Cells(21, 6)

RunSummaryForm.StdDeviation = Worksheets("Sheet1").Cells(20, 6)

RunS

First it looks as though you need to divide your answer by 100 unless the cell

format is currently set to percent.

Then use Round(yourformula,4)

try:

RunSummaryForm.StdDeviation = FormatNumber(Worksheets("Sheet1").Cells

(20, 6),4)

Didn't find what you were looking for?
Find more on Calculating values in VB
Or get search suggestion and latest updates.

Related Topics:

- Easier method to capture & paste calculated value?
- Add-Ins loaded into Excel
- Calculating duration
- How to calculate IRR
- Calculating the no. of containers
- Convert string like "=123+456+789" to Long and then calculate
- Application.Calculate fails
- calculating 'names' of text boxes in a form
- To calculate the time difference between two days
- 2003 - ActiveSheet.Calculate Problem
- Excel won't calculate my function
- Matching date values w/ dropdown values
- Calculate Total Sum
- Looping thru values to match w/ other values
- write a program that enters double data into an ArrayList and calculate the total
- calculate Mean
- calculating area of a regular polygon
- calculate age
- Calculate pH of Rainwater
- calculate area
- Calculating Ratios
- Calculate fields (Pivot Tables)
- VBA to Change value in column AQ based on values in I, and AI
- Convert string like "=123+456+789" to Long and then calculate
- calculate exeuction time