我在一个Excel工作表中获取要尝试导出的数据以导出到另一工作表时遇到了麻烦。我尝试了几种不同的方法,似乎无法仅获取要导出的数据。任何帮助将不胜感激。
这是我最近尝试的代码:
Public Sub HighlightDups()
Dim lastRow As Integer, compRow As Integer, rowNo As Integer, lastCol As Integer
With Sheets("Sheet1")
lastRow = .Cells(.Rows.Count, 15).End(xlUp).Row
lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column + 1
For rowNo = 2 To lastRow
.Cells(rowNo, lastCol) = Right(.Cells(rowNo, 15), 4)
Next
For rowNo = 2 To lastRow
If WorksheetFunction.CountIfs(.Range(.Cells(2, lastCol), .Cells(lastRow, lastCol)), .Cells(rowNo, lastCol), _
.Range(.Cells(2, 20), .Cells(lastRow, 20)), .Cells(rowNo, 20)) > 1 Then
Sheets("Sheet1").Cells(rowNo, 15).EntireRow.Copy Destination:=Sheets("Sheet2") _
.Range("A" & .Rows.Count).End(xlUp)
End If
Next
.Cells(1, lastCol).EntireColumn.ClearContents
End With
End Sub
答案 0 :(得分:1)
似乎您每次都将数据复制到同一行。在第二个For循环中使用docker stop ID
,您将得到最后一个填充行,而不是它下面的行,并用新值覆盖其内容。这是更正的代码:
docker rm ID