如何正确比较VBA Excel中的十进制字符?

时间:2019-06-12 06:36:53

标签: excel vba decimal

我在代码上遇到了麻烦,因为即使Please mention in your lightslider it will help you onSliderLoad: function (el) { var maxHeight = 0, container = $(el), children = container.children(); children.each(function () { var childHeight = $(this).height(); if (childHeight > maxHeight) { maxHeight = childHeight; } }); container.height(maxHeight); } (例如1.8 = 1.8),布尔值仍然返回(Me.scrFoilMarkup.Max / BigNum) = i。代码也就此结束-意味着程序在1.8 = 1.8处检测到False大于i。之所以选择BigNum(在我的情况下设为100,000)是因为用户窗体的滚动条在存储十进制数字时遇到问题,因此我将其转换为整数以防止出现此问题。

如果有帮助,可以将Me.scrFoilMarkup.Max / BigNum声明为i类型

Double

假设i = Me.scrFoilMarkup.Min / BigNum j=0 Do While i <= Me.scrFoilMarkup.Max / BigNum ThisWorkbook.Worksheets("Simulation-Chart").Cells(2 + j, 1) = i i = i + ((Me.scrFoilMarkup.Max - Me.scrFoilMarkup.Min) / BigNum) / 10 j= j + 1 Loop = 1.3且Me.scrFoilMarkup.Min / BigNum = 1.8,我需要编写的代码是知道Me.scrFoilMarkup.Max / BigNum确实等于i,然后应打印出电子表格中Me.scrFoilMarkup.Max / BigNum的值(如下所示)用作图表的值。

enter image description here

用户窗体初始化中的其他代码:

i

enter image description here

初始参数形式:

enter image description here

2 个答案:

答案 0 :(得分:0)

尝试将变量和公式与相同的数据类型和格式进行比较

Dim i As Variant, BigNum As Long

BigNum = 100000

i = Format(Me.scrFoilMarkup.Min / BigNum, "#.0")

Do While i <= Format(Me.scrFoilMarkup.Min / BigNum, "#.0")
    i = Format(i + ((Me.scrFoilMarkup.Max - Me.scrFoilMarkup.Min) / BigNum) / 10, "#.0")
Loop

修改
规避OP的十进制问题

Dim i As Variant, Mx As Variant, Mn As Variant
Dim BigNum As Long

BigNum = 100000

Mn = Me.scrFoilMarkup.Min
Mx = Me.scrFoilMarkup.Max

i = Mn / BigNum

Do While i <= Mn / BigNum
    i = i + ((Mx - Mn) / BigNum) / 10
Loop

答案 1 :(得分:0)

您应该使用componentDidMount() { this.getUserPhotos(); }; getUserPhotos= () => { //api call and set those data in the state. } render() { return ( <View> <View> <View> <View style={styles.smallsizepro}> // I need to append images here </View>

CDbl()

或使用MyDouble = CDbl(Me.scrFoilMarkup.Min / BigNum) ' Convert result to a Double.

Round

测试

MyDouble = Round((Me.scrFoilMarkup.Min / BigNum),2)

结果

enter image description here