使用列索引,如何复制特定的列

新的一天,新的问题。 我收到了很多帮助,希望你也能帮助我。 已经四处搜寻解决我的问题,但没有find。

这是我的代码:

SearchString = "start" Set aCell = phaseRange.Find(What:=SearchString, LookIn:=xlValues, _ LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If Not aCell Is Nothing Then Set bCell = aCell ReDim Preserve arrStart(nS) arrStart(nS) = aCell.Row nS = nS + 1 Do While ExitLoop = False Set aCell = phaseRange.FindNext(After:=aCell) If Not aCell Is Nothing Then If aCell.Row = bCell.Row Then Exit Do ReDim Preserve arrStart(nS) arrStart(nS) = aCell.Row nS = nS + 1 Else ExitLoop = True End If Loop Else End If 

并写出来:

 For i = 1 To nS - 1 Sheets("DataSheet").Select Sheets("raw_list").Rows(arrStart(i)).Copy Cells(i, 1).Select ActiveSheet.Paste Next 

正如你所看到的,我在一个string列中寻找。 当我得到一个结果时,行号存储在一个数组中。 在下面的代码片段中,我写出了整行的命中。 是否有可能,而不是采取整个行,select哪一列你想要以简单的方式复制?

感谢您的帮助

如果你已经知道列号,并且你有数组中的行,那么试试这个

 Sheets("raw_list").Cells(arrStart(i),5).Copy 

这将从第五列(Col E)复制特定行中的单元格。