Ich habe den folgenden Code gefunden, der gut zum Finden einer bestimmten Überschrift und Kopieren der Zeile darunter funktioniert.Finden Sie eine Überschrift und Offset-Kopie bestimmte Zellen
Private Sub Search_n_CopyV2()
Dim ws As Worksheet
Dim rngCopy As Range, aCell As Range, bcell As Range
Dim strSearch As String
strSearch = "Box E"
Set ws = Worksheets("Original")
With ws
Set aCell = .Columns(3).Find(What:=strSearch, LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not aCell Is Nothing Then
Set bcell = aCell
If rngCopy Is Nothing Then
Set rngCopy = .Rows(aCell.Row + 1)
Else
Set rngCopy = Union(rngCopy, .Rows((aCell.Row + 1)))
End If
Do
Set aCell = .Columns(3).FindNext(After:=aCell)
If Not aCell Is Nothing Then
If aCell.Address = bcell.Address Then Exit Do
If rngCopy Is Nothing Then
Set rngCopy = .Rows(aCell.Row + 1)
Else
Set rngCopy = Union(rngCopy, .Rows((aCell.Row + 1)))
End If
Else
Exit Do
End If
Loop
Else
MsgBox SearchString & " not Found"
End If
If Not rngCopy Is Nothing Then rngCopy.Copy Sheets("Output").Rows(1)
End With
End Sub
Ich hoffe, dies zu ändern, damit ich bestimmte Zellen kopieren kann.
Rohdatenformat:
Erwartetes Ergebnis:
Ich bin nicht sicher, was der beste Weg, um den aktuellen Code zu bearbeiten ist, diese Ergebnisse zu erzielen.