Sub Select_last_rowrange_selection()
Dim lastrow As Long
lastrow = Range("b1").Worksheet.UsedRange.Rows.Count
'this will select the column B used range
Range("b2:b" & lastrow).Select
'this will select the last row of column B
Range("b" & lastrow).Select
End Sub
Sub Select_last_row_from_range_selection()
Dim lastrow As Long, rng As Range
Set rng = Selection
lastrow = rng.Rows.Count
'this will select the last row of selected range
rng.Rows(lastrow).Select
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
rem select only one cell
If Target.Cells.Count = 1 Then
' ...
rem select more than one cells
Else
' ...
End If
End Sub
1条答案
按热度按时间zsbz8rwp1#
这就是你想要的吗?