您的位置:程序门 -> vb -> vba



vba 数字比较


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


vba 数字比较
发表于:2008-02-02 10:20:51 楼主
0.07与文件名mcommandlist_007.xls中的007如何依次比较,从而获得相等?谢谢了!
发表于:2008-02-02 10:35:331楼 得分:0
if   "mcommandlist_007.xls"   like   "*"   &   format(0.07   *   100,   "000")   &   "*"   then
        msgbox   "true"
else
        msgbox   "false"
end   if
发表于:2008-02-02 11:22:302楼 得分:0
哦,谢了,不过0.07是cells(i   ,j).value获得的,那么不确定单元格值的位数时如何比较?如取得0.008或1.1等等,谢谢再帮忙一下!
发表于:2008-02-02 12:51:523楼 得分:0
s=replace(cstr(0.07),".","")
发表于:2008-02-02 16:37:484楼 得分:0
str1=replace(cstr(0.07),".","")
str1="mcommandlist_"   &   str1   &   ".xls"
if   strcomp(str1,mcommandlist_007.xls,1)=0   then
msgbox   "ok"
endif
发表于:2008-02-03 09:01:475楼 得分:0
表达式:"mcommandlist_007.xls"   like   "*"   &   replace(cstr(text),".","")   &   "*"  

例:
if   "mcommandlist_007.xls"   like   "*"   &   replace(cstr(text),".","")   &   "*"   then   msgbox   "true"  


快速检索

最新资讯
热门点击