AW: Wochentagabfrage
14.07.2018 16:54:03
Laura
Hallo nochmal,
ich habe das Problem gelöst und poste den Code mal, falls jemand ein ähnliches Problem hat.
LG
Laura
PS: Der Code ist noch nicht formatiert.
Sub archivieren2()
_
Dim x As Range
Dim rng As Range
Dim sTag1 As String
Dim sTag2 As String
Dim sTag3 As String
Dim sTag4 As String
Dim sTag5 As String
Dim sTag6 As String
Worksheets("Archiv").Visible = True
sTag1 = Worksheets("KHilfstabelle").Range("A2")
Set x = Worksheets("Hilfstabelle").Range("C2:C7").Find(What:=sTag1, LookAt:=xlWhole, LookIn: _
=xlValues)
If x Is Nothing Then
MsgBox ("offk")
Else
_
Worksheets("Hilfstabelle").Range("A2:G7").Find(What:=sTag1, LookAt:=xlWhole, LookIn:= _
xlValues).EntireRow.Copy _
Destination:=Worksheets("KHilfstabelle").Range("A10:H10")
End If
'----------------------------------------------------------------------------------------------- _
sTag2 = Worksheets("KHilfstabelle").Range("A3")
Set x = Worksheets("Hilfstabelle").Range("C2:C7").Find(What:=sTag2, LookAt:=xlWhole, LookIn: _
=xlValues)
If x Is Nothing Then
MsgBox ("offk")
Else
_
Worksheets("Hilfstabelle").Range("A2:G7").Find(What:=sTag2, LookAt:=xlWhole, LookIn:= _
xlValues).EntireRow.Copy _
Destination:=Worksheets("KHilfstabelle").Range("A11:H11")
End If
'----------------------------------------------------------------------------------------------- _
sTag3 = Worksheets("KHilfstabelle").Range("A4")
Set x = Worksheets("Hilfstabelle").Range("C2:C7").Find(What:=sTag3, LookAt:=xlWhole, LookIn: _
=xlValues)
If x Is Nothing Then
MsgBox ("offk")
Else
_
Worksheets("Hilfstabelle").Range("A2:G7").Find(What:=sTag3, LookAt:=xlWhole, LookIn:= _
xlValues).EntireRow.Copy _
Destination:=Worksheets("KHilfstabelle").Range("A12:H12")
End If
'----------------------------------------------------------------------------------------------- _
sTag4 = Worksheets("KHilfstabelle").Range("A5")
Set x = Worksheets("Hilfstabelle").Range("C2:C7").Find(What:=sTag4, LookAt:=xlWhole, LookIn: _
=xlValues)
If x Is Nothing Then
MsgBox ("offk")
Else
_
Worksheets("Hilfstabelle").Range("A2:G7").Find(What:=sTag4, LookAt:=xlWhole, LookIn:= _
xlValues).EntireRow.Copy _
Destination:=Worksheets("KHilfstabelle").Range("A13:H13")
End If
'----------------------------------------------------------------------------------------------- _
sTag5 = Worksheets("KHilfstabelle").Range("A6")
Set x = Worksheets("Hilfstabelle").Range("C2:C7").Find(What:=sTag5, LookAt:=xlWhole, LookIn: _
=xlValues)
If x Is Nothing Then
MsgBox ("offk")
Else
_
Worksheets("Hilfstabelle").Range("A2:G7").Find(What:=sTag5, LookAt:=xlWhole, LookIn:= _
xlValues).EntireRow.Copy _
Destination:=Worksheets("KHilfstabelle").Range("A14:H14")
End If
'----------------------------------------------------------------------------------------------- _
sTag6 = Worksheets("KHilfstabelle").Range("A7")
Set x = Worksheets("Hilfstabelle").Range("C2:C7").Find(What:=sTag6, LookAt:=xlWhole, LookIn: _
=xlValues)
If x Is Nothing Then
MsgBox ("offk")
Else
_
Worksheets("Hilfstabelle").Range("A2:G7").Find(What:=sTag6, LookAt:=xlWhole, LookIn:= _
xlValues).EntireRow.Copy _
Destination:=Worksheets("KHilfstabelle").Range("A15:H15")
End If
End Sub