18.11.2020, 17:09
Hi Leute,
vielleicht ein ganz simples Problem, aber ich versuche mittels Makro einen Begriff auf einem nicht aktivierten Tabellenblatt zu löschen - geht das nicht?
Vielen Dank im Voraus :)
vielleicht ein ganz simples Problem, aber ich versuche mittels Makro einen Begriff auf einem nicht aktivierten Tabellenblatt zu löschen - geht das nicht?
Code:
Sub suchen()
Dim c As Range
Dim firstaddress As String
Dim sbegriff As String
Dim Datum As Date
Dim Startwoche As String
Dim Startwoche_Name As String
Dim Suchvariable As Range
Dim Startspalte As String
Dim i As Integer
sbegriff = InputBox("Bitte Suchbegriff eingeben")
Datum = InputBox("Datum")
Startwoche = CStr(WorksheetFunction.IsoWeekNum(Datum))
Set Suchvariable = ThisWorkbook.Sheets(Startwoche).Range("A1:G3").Find(what:=Datum, LookIn:=xlValues, lookat:=xlWhole)
With ThisWorkbook.Sheets(Startwoche).Range(Cells(2, Suchvariable.Column), Range("G3"))
Set c = .Find(sbegriff, LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
firstaddress = c.Address
Do
Range(Cells(c.Row, c.Column), Cells(c.Row, c.Column)) = ""
Set c = .FindNext(c)
Loop Until c Is Nothing
End If
End With
End Sub
Vielen Dank im Voraus :)