Sub 选中内容数字替换成正数方法1()
Dim r As Integer, R1 As Integer
Dim c As Integer, C1 As Integer
R1 = Selection.Rows.Count
C1 = Selection.Columns.Count
For r = 0 To R1 Step 1
For c = 0 To C1 Step 1
If Application.IsNumber(Selection.Range("A1").Offset(r, c)) And Selection.Range("A1").Offset(r, c) > 0 Then
Selection.Range("A1").Offset(r, c) = "正数"
End If
Next c
Next r
End Sub
Sub 选中正数行()
Dim rg As Range, Un As Range
Set Un = Range("A2")
For Each rg In Range("A2:C12")
If Application.IsNumber(rg) And rg.Value > 0 Then
Set Un = Union(Un, rg)
End If
Next rg
Un.EntireRow.Select
End Sub
Sub 选中内容数字替换正数方法2()
Dim rg As Range
For Each rg In Selection
If Application.IsNumber(rg) And rg.Value > 0 Then
rg.Value = "正数"
End If
Next rg
End Sub
|