只要符合条件,我就会尝试将特定单元格从一张纸张传输到另一张纸张。标准是Cell X =“Yes” 我宁愿只传输我需要的数据而不是整行,因为下一张表我将添加更多的数据。
Sheet1 "B3" needs to go to sheet2 "C3"
Sheet1 "C3" needs to go to sheet2 "D3"
Sheet1 "D3" needs to go to Sheet2 "E3"
Sheet1 "E3" needs to go to Sheet2 "F3"
这就是它开始变得混乱的地方
Sheet1 "G3" needs to go to Sheet2 "G3"
Sheet1 "H3" needs to go to Sheet2 "H3"
Sheet1 "J3" needs to go to Sheet2 "I3"
Sheet1 "K3" needs to go to Sheet2 "J3"
Sheet1 "M3" needs to go to Sheet2 "K3"
Sheet1 "Q3" needs to go to Sheet2 "M3"
Sheet1 "R3" needs to go to Sheet2 "N3"
Sheet1 "S3" needs to go to Sheet2 "O3"
Sheet1 "U3" needs to go to Sheet2 "Q3"
Sheet1 "V3" needs to go to Sheet2 "R3"
Sheet1 "W3" needs to go to Sheet2 "S3"
Sheet1 "X3" needs to go to Sheet2 "T3"
Sheet1 "Y3" needs to go to Sheet2 "U3"
Sheet1 "Z3" needs to go to Sheet2 "V3"
Sheet1 "AA3" needs to go to Sheet2 "W3"
Sheet1 "AB3" needs to go to Sheet2 "X3"
我可以粘贴和隐藏不会有问题的列,只要第一个进入需要的第3页并停在最后一个的位置,这样就不会删除我添加到下一列的内容。 我会粘贴我想要使用的东西,但它可能都是错误的,只会造成混淆
答案 0 :(得分:0)
我不知道这是不是你想要的,但这是你能做的。您需要做的就是在Then
Sub Class()
Dim c As Range
Dim i, j As Integer
'Where do you want to start to copy your information
'i = row
'j = column
i = 2
j = 1
On Error GoTo Errorcatch
'Instead of D3:D7, enter the range of your Yes,No cells
'Change Cells(c.Row, c.Column - 1) to whatever cells you want to copy (mines were left to my yes or no cells
For Each c In Range("O3:O37")
If c.Value = "Yes" Then
Sheets("Feuil1").Range(Cells(c.Row, c.Column - 14), Cells(c.Row, c.Column + 14)).Copy Sheets("Feuil2").Cells(i, j)
i = i + 1
End If
Next c
Exit Sub
Errorcatch:
MsgBox Err.Description
End Sub
我关注了您的驱动器并成功更新了代码以生成标签"是"。
希望这有帮助, Luisarcher。