Username: Password:

在EXCEL中获取列中不重复的值的个数-.NET教程,数据库应用
来源:作者: 发布时间:2007-12-26 02:04:20

public sub distinctcount()
求col列中startrow到endrow范围中不重复的个数
本例是计算标题为sheet1的excel表中的a1:a240的不重复值的个数
修改下面四行的结尾值
dim sheetscaption as string: sheetscaption = "sheet1"
dim col as string: col = "a"
dim startrow as integer: startrow = 1
dim endrow as integer: endrow = 240
以下固定
dim count as integer: count = 0
with sheets(sheetscaption)

for i = startrow to endrow
count = count + 1
for j = startrow to i - 1
if .range(col & i) = .range(col & j) then
count = count - 1
exit for
end if
next
next
end with
msgbox count
end sub

喜欢本文,那就收藏到:

    Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网
相关评论  我也要评论
还没有关于此文章的相关评论!
  • 昵称: (为空则显示guest)
  • 评论分数: ★ ★ ★★★ ★★★★ ★★★★★
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
  • 导航
    赞助商
    文章类别
    订阅