excel vba提取按列内容到单元

提取按列内容到单元

以下代码及注释为将A列中等于1的单元格,提取到B列对应的单元格中:
Sub main()
Dim i%
For i = 1 To Range("A65536").End(3).Row 'i从1到A列最后一个非空单元格的行号循环
If Cells(i, "A").Value = 1 Then '如果A列的值为1
Cells(i, "B") = Cells(i, "A") '则B列对应单元格的值等于A列的值
End If
Next i
End Sub
温馨提示:答案为网友推荐,仅供参考
第1个回答  2016-01-29
Sub s()
ceto = 2
t = Cells(Rows.Count, ceto).End(3)
n = Cells(Rows.Count, 11).End(3).Row
For i = 11 To 353
If Cells(n, i) > 2 Then
If Cells(n, i) - 3 = Cells(n - 1, i) Then Cells(1, i) = t
ElseIf Cells(n, i) = 0 Then
If Cells(n - 1, i) = 9 Then Cells(1, i) = t
Else
If Cells(n, i) + 6 = Cells(n - 1, i) Then Cells(1, i) = t
End If
Next
End Sub

本回答被提问者采纳