Sub Text_Zählen()
' Zählt wie oft ein Wort im Haupttext des aktiven Dokuments vorkommt
' Groß-/Kleinschreibung wird beim Zählen nicht unterschieden
' hierzu ggf. MatchCase von "False" auf "True" setzen
Dim Wort As String, Anzahl As Integer, BoxTitel As String
BoxTitel = "Wort in Dokument zählen"
Wort = InputBox("Zu zählendes Wort ?", BoxTitel, "Text")
If Wort = "" Then Exit Sub
Anzahl = 0
With ActiveDocument.Content.Find
.ClearFormatting
.Text = Wort
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
Do While .Execute(FindText:=Wort) = True
Anzahl = Anzahl + 1
Loop
End With
Ausgabe = MsgBox(Wort & " " & Anzahl & " mal", vbOKOnly, BoxTitel)
Text_Zählen Makro
'
' Tastenkombination: Strg+z
'
End Sub
Laufzeitfehler '424' :
Objekt erforderlich
Option Explicit
Sub Übereinstimmungen_finden()
Dim strSuchbegriff As String
Dim strAddresse As String
Dim lngAnzahl As Long
Dim rngFundstelle As Range
strSuchbegriff = InputBox("Schbegriff eingeben")
With Range("A1:A65536")
Set rngFundstelle = .Find(What:=strSuchbegriff, LookIn:=xlValues)
If Not rngFundstelle Is Nothing Then
strAddresse = rngFundstelle.Address
Do
lngAnzahl = lngAnzahl + 1
Set rngFundstelle = .FindNext(rngFundstelle)
Loop While Not rngFundstelle Is Nothing And rngFundstelle.Address <> strAddresse
End If
End With
MsgBox "Begriff " & strSuchbegriff & " wurde " & lngAnzahl & "x gefunden"
End SubIch hoffe, Du kommst klar. Bei Fragen melde Dich.
Summe von bestimmten zahlen mit bestimmten symbolen (z.B. % Zeichen)
AlexSocke 07.06.2008 - 55 Hits - 6 Antworten
mit Makro ein Zeichen löschen
Chrissi_Li 02.09.2008 - 14 Hits - 2 Antworten
Anzahl Zellen zwischen bestimmten Wörtern!
Wastl1235 12.09.2008 - 11 Hits - 12 Antworten
Zahlen zählen
manzur1 15.03.2009 - 272 Hits - 5 Antworten
Makro Zeichen finden, Zeile einfügen, Summe bilden
supportochse 04.05.2009 - 356 Hits - 2 Antworten