Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 2855|回复: 3

[已解决]解释一下

[复制链接]
发表于 2014-12-31 21:35 | 显示全部楼层 |阅读模式
本帖最后由 mmc998 于 2015-1-1 20:55 编辑

ar = Range("b3:g" & Cells(Rows.Count, 2).End(3).Row)
最佳答案
2014-12-31 21:52
ar = Range("b3:g" & Cells(Rows.Count, 2).End(3).Row)
Cells(Rows.Count, 2).End(3).Row相当于 Cells(Rows.Count, 2).End(xlup).Row
Cells(Rows.Count, 2)就是第二列最后一个单元格,end(xlup).Row 往上找第一个不为空的单元格,获取行号
行号知道了,那么区域range("B3:G"&行号)也就知道了
然后赋值给数组ar
发表于 2014-12-31 21:42 | 显示全部楼层
  1. ar = Range("b3:g" & Cells(Rows.Count, 2).End(3).Row)
复制代码
cells(rows.count,2).end(3).row 获取B列非空单元格的行数,与range("b3:g"& 一起构成单元格区域。对动态数组ar进行赋值。
回复

使用道具 举报

发表于 2014-12-31 21:52 | 显示全部楼层    本楼为最佳答案   
ar = Range("b3:g" & Cells(Rows.Count, 2).End(3).Row)
Cells(Rows.Count, 2).End(3).Row相当于 Cells(Rows.Count, 2).End(xlup).Row
Cells(Rows.Count, 2)就是第二列最后一个单元格,end(xlup).Row 往上找第一个不为空的单元格,获取行号
行号知道了,那么区域range("B3:G"&行号)也就知道了
然后赋值给数组ar
回复

使用道具 举报

发表于 2014-12-31 22:39 来自手机 | 显示全部楼层
哪里不懂选中哪里,再按f1,先看帮助,我不懂时也是看帮助
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-19 17:28 , Processed in 0.239417 second(s), 8 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表