分享

VBA常用函数

 yuzhoushenling 2014-03-24

Chr(charcode),ChrB,ChrW,第一个ANSI,第二个Unicode

Asc(string),AscB,AscW

Instr([start, ]string1, string2[, compare])

compare取值

vbUseCompareOption

vbBinaryCompare

vbTextCompare

vbDataCompare(仅适用于Access)

Len(string| varname)

Replace(expression, find, replace[, start[, count[, compare]]])

UBounde(arrayname[, dimension])     LBounde返回指定维的最大上小标,计算维数要+1

Split(expression[, delimiter[, limit[, compare]]])

Weekday(date, [firstdayofweek]), day为日期的Variant、数值表达式、字符串或它们的组合,例如”2014324””2014/3/24”#3/24/2014#

DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]])

interval取值

yyyy

ww

日历周

q

h

m

n

分钟

yd

s

w

实际周

 

 


Year(date), Month, Day

Dateserial(year, month, day)返回一个Variant数值,如Dateserial(2014,3,24)返回2014/3/24

Array(arglist), IsArray()

Match(lookup_value, lookup_array,match_type)

match_type取值

1

lookup_value的最大值

lookup_array升序排列

0

=

任意排列

-1

lookup_value的最小值

lokup_array降序排列

Countif(range, criteria), criteria可以为32, “32”, “>32”, “apples”

Filter(sourcearray, match[, include[, compare]])   该函数部分匹配

match=true返回包含match的数

Tranpose(array)只能作用于下标从1开始的二维或者一维数组

Round(expression[, numdecimalplaces])Banker舍入

Application.WorkSheetsFunction.Round(n,d)是算术舍入 

IsError(expression)

IIf(expr, truepart, falsepart)

Vlookup(lookup_value, table_array, col_index_num, range_lookup)

range_lookup=true近似匹配,false精确匹配 

Hex(string)返回代表16进制的string

Right(string, length)   Left

Val(string)返回字符串内的数字

Format(expression[, format[, firstdayofweek[, firstweekofyear]]])

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多