我尝试创建一个宏,在其中从actieve工作簿中选择一个值,然后在另一工作簿中进行搜索,然后在找到该值时选择像array这样的单元格(actieve单元格向右移动一个单元格并选择该单元格,然后选择2列之后的另一个单元格,然后选择“赞”: (C2,F2,I2,L2 ....)。复制 并转存到第一个工作簿中
也许很难解释,但我认为代码会更好:
Sub Find_copy_paste()
Dim FindString As String
Dim Rng As Range
Dim y As Workbook
Dim x as Workbook
Set y = Workbooks("H\Data1.xlsm")
Set x = Workbooks.Open("G\info.xlsx")
FindString = y.Sheets("Teams").Range("A121").Value
If Trim(FindString) <> "" Then
With x.Sheets("Claims").Range("B:B")
Set Rng = .find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
**'' I want hier to select actieve cell then one step to the right and start to copy array ( C2,F2,I2,L2 ....) then paste it transpose in y workbook**
Else
MsgBox "Nothing found"
End If
End With
End If
End Sub
任何人都能帮忙吗??
谢谢:)