Mit nachfolgendem Code, wird wenn ein Hackerl in der Checkbox gesetzt ist, eine 1 in der Spalte Z sowie bei keinem Hackerl eine 0 in der jeweiligen gewünschten Zeile gesetzt.
Ich möchte jedoch folgendes erreichen:
Ist ein Hackerl gesetzt, dann soll der untere Code ausgeführt werden.
Ist kein Hackerl gesetzt, dann soll der Code nicht mehr ausgeführt werden.
wie und wo müßte ich hier eine Änderung des code vornehmen?
If Controls("Checkbox").Value=False Then ?
Private Sub CommandButton2_Click()
Dim rngFind As Range
Dim intCount As Integer, intCol As Integer, lngRow As Long
If Not IsDate(datumtxt1) Then Exit Sub
With ActiveSheet
Set rngFind = .Range("B:B").Find(What:=CDate(datumtxt1), LookAt:=xlWhole, LookIn:=xlFormulas)
If Not rngFind Is Nothing Then
lngRow = rngFind.Row
intCol = 26
For intCount = 1 To 23
Select Case intCount
Case 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23
'If Controls("CheckBox" & intCount) > 0 Then
If Len(Trim$(Controls("CheckBox" & intCount))) > 0 Then
If IsNumeric(Controls("CheckBox" & intCount)) Then
'.Cells(lngRow, intCol) = CSng(Controls("CheckBox" & intCount))
.Cells(lngRow, intCol) = Abs(CDbl(Controls("CheckBox" & intCount)))
Else
.Cells(lngRow, intCol) = Controls("CheckBox" & intCount)
End If
End If
intCol = intCol + 1
Case Else
lngRow = lngRow + 1
intCol = 26
End Select
Next
End If
Set rngFind = Nothing
End With
End Sub
Danke
Josef