[英]Go to last used row from row x onwards, ignore blanks?
當用戶單擊一個單元格時,我想將用戶帶到電子表格中從第5行開始的最后使用的行。
由於某種原因,這不起作用,並產生對象工作表失敗錯誤的方法范圍。
碼:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = Range("AB2").Column Then
Range("A4" & Rows.Count).End(xlUp).Select
End If
End Sub
請有人能告訴我我要去哪里錯嗎?
這將跳到最后使用的行,但至少跳到第5行
If Range("A" & Rows.Count).End(xlUp).Row < 5 Then
Range("A5").Select
Else
Range("A" & Rows.Count).End(xlUp).Select
End If
工作表的最后一行位於其UsedRange
右下角,因此:
[a1].SpecialCells(xlLastCell).Row
將找到最后一行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.