|
- Option Explicit
- Sub 题目1()
- Dim rg As Range
- Dim x As Integer
- Dim y As Integer
- For x = 4 To 8 Step 1
- For y = 1 To 3 Step 1
- Set rg = Sheets(1).Cells(x, y)
- If rg.Value > 0 And IsNumeric(rg.Value) Then
- rg.Value = "正数"
- End If
- Next y
- Next x
-
- End Sub
- Sub 题目2()
- Dim x As Integer
- Dim y As Integer
- Dim rg As Range
-
- For x = 2 To 12 Step 1
- For y = 1 To 3 Step 1
- If Cells(x, y) > 0 And IsNumeric(Cells(x, y)) Then
- If rg Is Nothing Then
- Set rg = Cells(x, y)
- Else
- Set rg = Union(rg, Cells(x, y))
- End If
- End If
- Next y
- Next x
- rg.EntireRow.Select
- End Sub
复制代码
|
|