EXCEL VBA 问题。从range里减掉最后一列。
假设有range=[a1:b10]现在我想让该range成为=[a1:b9]也就是减掉最后一列,这VBA怎么写?...
假设有 range = [a1:b10]
现在我想让该 range 成为 = [a1:b9]
也就是减掉最后一列,这VBA怎么写? 展开
现在我想让该 range 成为 = [a1:b9]
也就是减掉最后一列,这VBA怎么写? 展开
展开全部
去弄清楚什么叫列,什么叫行。
减列:
Dim Rng1 As Range, Rng2 As Range
Set Rng1 = [a1:b10]
Set Rng2 = Rng1.Columns(1).Resize(, Rng1.Columns.Count - 1)
减行:
Dim Rng1 As Range, Rng2 As Range
Set Rng1 = [a1:b10]
Set Rng2 = Rng1.Rows("1:" & Rng1.Rows.Count - 1)
2015-04-10 · 知道合伙人软件行家
关注
展开全部
那就直接range = [a1:b9]呀
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
您好,这样:
Function LastColumn() As Long
Dim ix As Long
ix = ActiveSheet.UsedRange.Column - 1 + ActiveSheet.UsedRange.Columns.Count
LastColumn = ix
End Function
Function LastRow() As Long
Dim ix As Long
ix = ActiveSheet.UsedRange.Row - 1 + ActiveSheet.UsedRange.Rows.Count
LastRow = ix
End Function
Function LastColumn() As Long
Dim ix As Long
ix = ActiveSheet.UsedRange.Column - 1 + ActiveSheet.UsedRange.Columns.Count
LastColumn = ix
End Function
Function LastRow() As Long
Dim ix As Long
ix = ActiveSheet.UsedRange.Row - 1 + ActiveSheet.UsedRange.Rows.Count
LastRow = ix
End Function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询