1个回答
展开全部
试试执行以下的宏代码:
Sub CopyNum()
Dim i As Integer, j As Integer
Dim iR As Range
i = 35: j = 42 '写入的起始行为35,起始列为42
For Each iR In Range("B7:BK7")
If iR.Column Mod 2 > 0 Then GoTo NEXTFOR '奇数列不取数据
If iR.Value <> "" Then
Cells(i, j) = iR.Value
j = j + 1
If j > 51 Then
i = i + 1: j = 42
End If
End If
NEXTFOR:
Next
End Sub
Sub CopyNum()
Dim i As Integer, j As Integer
Dim iR As Range
i = 35: j = 42 '写入的起始行为35,起始列为42
For Each iR In Range("B7:BK7")
If iR.Column Mod 2 > 0 Then GoTo NEXTFOR '奇数列不取数据
If iR.Value <> "" Then
Cells(i, j) = iR.Value
j = j + 1
If j > 51 Then
i = i + 1: j = 42
End If
End If
NEXTFOR:
Next
End Sub
追问
如果提取黄色单元数据,
'偶数列不取数据?
如何修改代码
追答
If iR.Column Mod 2 = 0 Then GoTo NEXTFOR '偶数列不取数据
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询