我想找到一个范围内数据的最后一行。例如,我想在范围内找到最后一个空行(“A15:A42”)。它不应该超越A42。任何帮助。
lRow = Range("C15:C42").End(xlDown).Row ....it goes beyond C42..
从评论中复制IMP信息
是..我将从C43获得一些其他数据... - user2703472 3小时前
答案 0 :(得分:2)
这是你在尝试什么?我假设C15
有数据。
Option Explicit
Sub sample()
Dim ws As Worksheet
Dim rng As Range
Dim LRow As Long
'~~> Change this to the relevant sheet
Set ws = ThisWorkbook.Sheets("Sheet1")
With ws
Set rng = .Range("C15:C42")
LRow = .Range(Split(.Cells(, rng.Column).Address, "$")(1) & _
(rng.Row + rng.Rows.Count)).End(xlUp).Row
Debug.Print LRow
End With
End Sub
<强>截图强>: