Live-Forum - Die aktuellen Beiträge
Datum
Titel
24.04.2024 19:29:30
24.04.2024 18:49:56
Anzeige
Archiv - Navigation
536to540
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
536to540
536to540
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Code Änderung

Code Änderung
25.12.2004 20:26:04
Dieter
Hallo Forum, frohe Weihnachten zusammen.
Ich habe den unten dargestellten Code, im vorigen Jahr hier aus dem Forum erhalten.
Es handelt sich um eine Tabelle in der die Mitspieler die Zusatzzahl vorher sagen.Es werden jede Woche 36,00 € ausgespielt, sollte die Z.Z. nicht getroffen werden verdoppelt sich der Betrag in der nächsten Auspielung.
Im letzten Jahr nahmen wir 36,00 € mit in das neue Jahr,und bei der ersten Ziehung in 2004 wurde die 36,00 € aus 2003 sofort dazu addiert.
Nun habe wir aber keinen Betrag den wir ins neu Jahr mit nehmen. Welche Änderung muss nun an dem Code vorgenommen werden so das bei der ersten Ausspielung 36,00 angezeigt wird.
Wer kann mir dabei behilflich sein ?
MfG Dieter

Private Sub CommandButton1_Click()
Dim Zusatzzahl
Titel = "Zusatzzahl"
Mldg = "Zusatzzahl eingeben"
Zusatzzahl = InputBox(Mldg, Titel)
With Sheets(1).Range(Cells(101, 2), Cells(126, 3))
Set C = .Find(Zusatzzahl, LookIn:=xlValues, LookAt:=xlWhole)
If C Is Nothing Then
r = Cells(100, 2).End(xlUp).Row + 1
Cells(r, 5) = "xxx"
Cells(r, 3) = "nein"
Cells(r, 2) = Zusatzzahl
Cells(r, 6) = "nein"
MsgBox "Zusatzzahl nicht vorhanden"
Exit Sub
End If
End With
r = Cells(100, 2).End(xlUp).Row + 1
If r < 4 Then r = 5
If C(1, 1).Column = 2 Then f = 0 Else f = -1
Cells(r, 5) = C(1, f)
Cells(r, 2) = C(1, 1)
Cells(r, 3) = "ja"
Cells(r, 4) = 36
Cells(r, 6) = "ja"
For i = Cells(100, 3).End(xlUp).Row To 5 Step -1
If Cells(i - 1, 3) <> "ja" Then
Cells(r, 4) = Cells(r, 4) + 36
Else
i = 5
End If
Next i
With Sheets(2).Columns(1)
Spieler = Cells(r, 5)
Set S = .Find(Spieler, LookIn:=xlValues, LookAt:=xlWhole)
If S Is Nothing Then
i = .Cells(65536, 1).End(xlUp).Row + 1
.Cells(i, 1) = Cells(r, 5)
.Cells(i, 2) = 1
Else
S(1, 2) = S(1, 2) + 1
S(1, 3) = S(1, 3) + Cells(r, 4)
End If
End With
End Sub

5
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Code Änderung
Beni
Hallo Dieter,
dieser Code stammt von mir, ich habe Zeile markiert.
Gruss Beni

Private Sub CommandButton1_Click()
Dim Zusatzzahl
Titel = "Zusatzzahl"
Mldg = "Zusatzzahl eingeben"
Zusatzzahl = InputBox(Mldg, Titel)
With Sheets(1).Range(Cells(101, 2), Cells(126, 3))
Set C = .Find(Zusatzzahl, LookIn:=xlValues, LookAt:=xlWhole)
If C Is Nothing Then
r = Cells(100, 2).End(xlUp).Row + 1
Cells(r, 5) = "xxx"
Cells(r, 3) = "nein"
Cells(r, 2) = Zusatzzahl
Cells(r, 6) = "nein"
MsgBox "Zusatzzahl nicht vorhanden"
Exit Sub
End If
End With
r = Cells(100, 2).End(xlUp).Row + 1
If r < 4 Then r = 5
If C(1, 1).Column = 2 Then f = 0 Else f = -1
Cells(r, 5) = C(1, f)
Cells(r, 2) = C(1, 1)
Cells(r, 3) = "ja"
Cells(r, 4) = 36Cells(r, 6) = "ja"
For i = Cells(100, 3).End(xlUp).Row To 5 Step -1
If Cells(i - 1, 3) <> "ja" Then
'Cells(r, 4) = Cells(r, 4) + 36 diese Zeile weg
Else
i = 5
End If
Next i
With Sheets(2).Columns(1)
Spieler = Cells(r, 5)
Set S = .Find(Spieler, LookIn:=xlValues, LookAt:=xlWhole)
If S Is Nothing Then
i = .Cells(65536, 1).End(xlUp).Row + 1
.Cells(i, 1) = Cells(r, 5)
.Cells(i, 2) = 1
Else
S(1, 2) = S(1, 2) + 1
S(1, 3) = S(1, 3) + Cells(r, 4)
End If
End With
End Sub

Anzeige
AW: Hallo Beni
25.12.2004 21:58:27
Dieter
Hallo Beni,wünsch Dir ein frohes Fest Danke für deine erneute Hilfe.Dein Code ist das ganze Jahr ohne den Dienst zu versagen einwandfrei gelaufen, einfach Klasse.
Nochmal besten Dank und einen Guten rutsch ins neue Jahr.
MfG Dieter
AW: Hallo Beni bitte nochmal melden
25.12.2004 22:05:55
Dieter
Hallo Beni, ich habe den Code nach deinen Vorschlag geändert. Nach mehrmaligen Test funz nun aber nicht mehr , wenn eine Woche kein Treffer gelandet wurde das die Summe in der nächsten Woche sich verdoppelt.
Weißt Du vieleicht noch einen Rat ?
MfG Dieter
AW: Hallo Beni bitte nochmal melden
Beni
Hallo Dieter,
ich musste mich zuerst in den Code hinein denken.
Gruss Beni

Private Sub CommandButton1_Click()
Dim Zusatzzahl
Titel = "Zusatzzahl"
Mldg = "Zusatzzahl eingeben"
Zusatzzahl = InputBox(Mldg, Titel)
With Sheets(1).Range(Cells(101, 2), Cells(126, 3))
Set C = .Find(Zusatzzahl, LookIn:=xlValues, LookAt:=xlWhole)
If C Is Nothing Then
r = Cells(100, 2).End(xlUp).Row + 1
Cells(r, 5) = "xxx"
Cells(r, 3) = "nein"
Cells(r, 2) = Zusatzzahl
MsgBox "Zusatzzahl nicht vorhanden"
Exit Sub
End If
End With
r = Cells(100, 2).End(xlUp).Row + 1
If r < 4 Then r = 5
If C(1, 1).Column = 2 Then f = 0 Else f = -1
Cells(r, 5) = C(1, f)
Cells(r, 2) = C(1, 1)
Cells(r, 3) = "ja"
Cells(r, 4) = 36
For i = Cells(100, 3).End(xlUp).Row To 5 Step -1
If Cells(i - 1, 3) = "nein" Then
Cells(r, 4) = Cells(r, 4) + 36
Else
i = 5
End If
Next i
With Sheets(2).Columns(1)
Spieler = Cells(r, 5)
Set S = .Find(Spieler, LookIn:=xlValues, LookAt:=xlWhole)
If S Is Nothing Then
i = .Cells(65536, 1).End(xlUp).Row + 1
.Cells(i, 1) = Cells(r, 5)
.Cells(i, 2) = 1
Else
S(1, 2) = S(1, 2) + 1
S(1, 3) = S(1, 3) + Cells(r, 4)
End If
End With
End Sub

Anzeige
AW: Hallo Beni
26.12.2004 15:15:25
Dieter
Hallo Beni,Danke für deine Hilfe.
Viele Grüsse Dieter

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige