如果我的列的日期为5-10-2016,而它的行是从第3行到第23行。最佳方法是获取相同值的最后一个行号(5-10-2016)。日期将始终更改,行数也将不同。谢谢! 吉姆
答案 0 :(得分:0)
您可以从最后一行开始查找
Sub FindLastRow()
Dim dt as Date, i as Long, wk As worksheet
Set wk = sheet1
dt = wk.Range("B1").value2
For i= wk.Range("B" & Rows.Count).End(xlUp).Row to 2 Step -1
if wk.Range("B" & i).Value2 = dt then
msgbox "Last Row with Date :" & dt & " is " & i
Exit Sub
End if
Next i
Msgbox "Date Not Found"
End Sub