我想获取从声明的单元格计算的下一个空行的数量: 正如您所看到的,这是问题所在:
Sub sup_rapp1()
'*variables
Dim CELDEB As Range, LIGNEFIN As Long, COLONEFIN As Long, WS As Worksheet
'set objet : affecter les objets
Set WS = Sheets("TAB1")
Set CELDEB = Range("A4")
'derniere ligne at colonne of data
LIGNEFIN = WS.Cells(WS.Rows.Count, CELDEB.Column).End(xlUp).Row
MsgBox LIGNEFIN
Sub sup_rapp1()
'*variables
Dim CELDEB As Range, LIGNEFIN As Long, COLONEFIN As Long, WS As Worksheet
'set objet : affecter les objets
Set WS = Sheets("TAB1")
Set CELDEB = Range("A4")
'derniere ligne at colonne of data
LIGNEFIN = WS.Cells(WS.Rows.Count, CELDEB.Column).End(xlDown).Row
MsgBox LIGNEFIN
答案 0 :(得分:1)
我认为这就是你要找的东西:
Set WS = Sheets("TAB1")
Set CELDEB = WS.Range("A4")
LIGNEFIN = CELDEB.CurrentRegion.Row + CELDEB.CurrentRegion.Rows.Count
MsgBox CStr(LIGNEFIN)
CurrentRegion
为您提供细胞所在区域的边界。
你的代码没有得到正确结果的原因是你选择了工作表上的最后一行然后上升,这给了你11
或者当你失败时(你留在最后一行) )它给了你另一个价值。