Hallo,
ich habe diesen Code im Internet gefunden. (siehe Sub Test)
Leider komme ich nicht weiter, könnt Ihr mir bitte weiterhelfen?
Ich möchte das nach dem Wort "gesamt" gesucht wird und gefundene Zelle/Spalten markiert wird.
Danach soll das hier unter ausführt!
Dim strPassword As String
strPassword = "112"
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect Password:=strPassword, DrawingObjects:=True, Contents:=True, Scenarios:=True
Danke schon mal für Eure hilfe
LG Joan
Sub test()
Dim c1 As Range
Dim firstAddress
Dim secondAddress
Dim str
Dim i As Integer
Dim Bereich As Range
str = "gesamt"
Set Bereich = Columns(34)
With Worksheets("Vertriebswege").Range("D:AH")
For i = 1 To 34
Set c1 = .Find(str)
If Not c1 Is Nothing Then
firstAddress = c1.Address
Bereich = Union(Columns(c1.Column), Columns(c1.Column)).EntireColumn.Select
Do
Bereich = Union(Columns(c1.Column), Columns(c1.Column)).EntireColumn.Select
Set c1 = .FindNext(c1)
Loop While Not c1 Is Nothing And c1.Address <> firstAddress
End If
Next
End With
End Sub