LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default WorksheetFunction.Round using user-selectable rounding value?

I'm trying to write code to round the value of cell b45 on the Output
worksheet to the number of digits specified on the Input worksheet.

RoundingValue is defined as an integer elsewhere (in a worksheet change
event).

Sub RoundingOptions()

If Sheets("Input").Cells(35, 4).Value = "Hundred Dollars" Then
RoundingValue = -2
Else
If Sheets("Input").Cells(35, 4).Value = "Thousand Dollars" Then
RoundingValue = -3
Else
If Sheets("Input").Cells(35, 4).Value = "Million Dollars"
Then
RoundingValue = -6
Else: RoundingValue = 0
End If
End If
End If

Sheets("Output").Cells(45, 3).Value =
Application.WorksheetFunction.Round(Sheets("Output ").Cells(45,
2).Value, RoundingValue)


End Sub

The code above always puts a zero value in cell c43. I've checked the
value of both cell b43 and RoundingValue before executing that portion
of the code, and the values are correct... so there is a problem with
the way that I'm trying to place the new rounded value in cell c43.

Any suggestions would be appreciated!

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ROUNDING FORMULA =ROUND(B12/$B$10,1) ROUNDING TO HIGH SunshineinFt.Myers[_2_] Excel Worksheet Functions 7 March 5th 09 06:41 PM
User Selectable Series and Number of Series for Line Chart Dave in NJ Charts and Charting in Excel 2 February 23rd 09 12:18 AM
Formula help - rounding up and round down? 0greeny0 Excel Worksheet Functions 2 February 21st 09 12:10 PM
Help please- user selectable image Regnar Excel Programming 1 April 21st 04 06:09 PM
WorkSheetFunction.CountIf & WorkSheetFunction.SumIf with 2 conditions? Etien[_2_] Excel Programming 3 January 13th 04 04:07 PM


All times are GMT +1. The time now is 09:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"