|
E05:linch92413交作业
Sub Range_Methor()
Dim i As Long
Dim R As String
For i = 2 To Range("d65536").End(xlUp).Row
If Cells(i, 4) > 20 Then
R = R & "," & i & ":" & i
End If
Next i
MsgBox Right(R, Len(R) - 1)
Range(Right(R, Len(R) - 1)).Select
End Sub
Sub Row_Methor()
Dim i As Long
Dim R As Range
For i = 2 To Range("d65536").End(xlUp).Row
If Cells(i, 4) > 20 Then
If R Is Nothing Then
Set R = Rows(i)
Else
Set R = Union(R, Rows(i))
End If
End If
Next i
R.Select
End Sub
Sub Union_Methor()
Dim i As Long
Dim N As String
Dim Rg As Range
For i = 2 To Range("d65536").End(xlUp).Row
If Cells(i, 4) > 20 Then
If Rg Is Nothing Then
Set Rg = Cells(i, 4)
Else
Set Rg = Union(Rg, Cells(i, 4))
End If
End If
Next i
Rg.EntireRow.Select
End Sub
VBA基础入门第10课作业题(linch92413).rar
(10.78 KB, 下载次数: 3)
|
|