Frage zu "Select Case"
30.11.2016 08:43:12
cH_rI_sI
Nun muss ich mich leider auch wieder einmal mit einem Problem melden, bei dem Ihr mir hoffentlich wieder helfen könnt.
Ich möchte bei u.a. Code die Select Case - Anweisung um den Fall "Nein" erweitern - so funktioniert es auf jeden Fall nicht:
Sub Zusammenfassung()
Dim WS1 As Worksheet, WS2 As Worksheet
Dim iZeile As Long, tempZeile As Long, iZähler As Long
Dim strMark As String
Set WS1 = Worksheets("Fragen (BL4)")
Set WS2 = Worksheets("Zusammenfassung (BL2)")
ActiveSheet.Unprotect
Application.ScreenUpdating = False
For iZeile = WS1.Cells(WS1.Rows.Count, 9).End(xlUp).Row To 9 Step -1
If IsNumeric(WS1.Cells(iZeile, 9)) And WS1.Cells(iZeile, 9) "" And _
WorksheetFunction.CountIf(WS2.Columns(1), WS1.Cells(iZeile, 1)) = 0 And _
Left(WS1.Cells(iZeile, 1), 4) "Punk" And _
Left(WS1.Cells(iZeile, 1), 4) "Erfü" Then
iZähler = iZähler + 1
Select Case WS1.Cells(iZeile, 9)
'Case 10: strMark = "Positive Bemerkungen"
Case 8: strMark = "Hinweise / Verbesserungsvorschläge:"
Case 6: strMark = "Nebenabweichungen:"
Case 4: strMark = "Hauptabweichungen:"
Case 0: strMark = "Hauptabweichungen:"
Case "Nein": strMark = "Hinweise / Umwelt Management:"
Case Else: strMark = ""
End Select
If strMark "" Then
tempZeile = Application.Match(strMark, WS2.Columns(3), 0) + 1
WS2.Rows(tempZeile).Insert Shift:=xlDown
WS2.Cells(tempZeile, 1) = WS1.Cells(iZeile, 1)
WS2.Cells(tempZeile, 3) = WS1.Cells(iZeile, 11)
Call ZeileFormatieren(tempZeile, WS2)
Call sortieren
End If
End If
Next iZeile
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingRows:=True, _
AllowInsertingRows:=True, AllowInsertingHyperlinks:=True, _
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True
End Sub
Was mache ich falsch? Bitte um Eure Hilfe - Danke!!!Lg,
Chrisi