|
本帖最后由 optimus 于 2017-12-6 20:20 编辑
- Sub positive()
- Dim rg As Range, m As Integer, i As Integer
- i = 1
- Set rg = Selection
- m = Selection.Cells.Count
- 'range(selction),range"a1"
- For i = 1 To m
- If Application.WorksheetFunction.IsNumber(rg.Cells(i)) = True Then
-
- If Selection.Cells(i) > 0 Then
- Selection.Cells(i) = "正数"
- End If
- End If
- Next i
- End Sub
- Sub selct()
- Dim rng As Range, rng2 As Range, rng1 As Range
- Dim i As Integer
- Set rng = Range("a2:c12")
- Set rng2 = Nothing
- For i = 1 To rng.Cells.Count Step 1
- If Application.WorksheetFunction.IsNumber(rng.Cells(i)) = True And rng.Cells(i) > 0 Then
- If (rng2 Is Nothing) Then
- Set rng2 = rng.Cells(i)
- End If
- Set rng2 = Union(rng2, rng.Cells(i))
复制代码 怎么在选中的单元格集合里面剔除某个单元格?
例如
range("a1:c10").select
怎么剔除里面的B2?
用第二个程序选择了多行数据后,再用第一个数据替换数字为“正数“,为什么有部分替换不了?
循环次数有限制吗?
|
|