330 Aufrufe
Gefragt in Tabellenkalkulation von ekg Mitglied (303 Punkte)
Hallo
ich möchte in einer Tabelle die aus aus mehreren Spalten und Zeilen besteht die Zeilen löschen in denen das Wort Summe vorkommt.

Das Wort ist in mehreren Spalen vorhanden und heißt mal
summe oder mal Gesamtsumme.

Gruß

2 Antworten

0 Punkte
Beantwortet von fedjo Experte (2.2k Punkte)
Hallo,
versuch es mal so:

Sub Suchen()
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim c
Dim firstAddress As String
Dim secAddress
Dim GFound As Boolean
Dim GWeiter, Gzwei As Boolean

SSearch = "Summe"
weiter:
For Each ws In Worksheets
With ws.Cells
Set c = .Find(SSearch, LookIn:=xlValues, MatchCase:=False)
If Not c Is Nothing Then
ws.Select
c.Select
Selection = "Summe"
Selection.EntireRow.Delete
If Not c Is Nothing Then
Do
GoTo weiter
c.Select

Loop While Not c Is Nothing And secAddress <> firstAddress And c.Address <> firstAddress

End If
End If
End With
Next ws
Search = "Gesamtsumme"
zwei:
For Each ws In Worksheets
With ws.Cells
Set c = .Find(Search, LookIn:=xlValues, MatchCase:=False)
If Not c Is Nothing Then
ws.Select
c.Select
Selection = "Gesamtsumme"
Selection.EntireRow.Delete

If Not c Is Nothing Then
Do
GoTo zwei
c.Select
Loop While Not c Is Nothing And secAddress <> firstAddress And c.Address <> firstAddress
End If
End If
End With
Next ws
End Sub
Es gibt bestimmt auch noch eine bessere Lösung.

Gruß
0 Punkte
Beantwortet von ekg Mitglied (303 Punkte)
Hallo fedjo

vielen Dank funzt sehr gut.


Gruß Erwin
...