09.02.2014 Aufrufe

Ein VBA-Programm in Excel

Ein VBA-Programm in Excel

Ein VBA-Programm in Excel

MEHR ANZEIGEN
WENIGER ANZEIGEN

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

Case 2 To 6<br />

ZelleMitNameFuellen<br />

'Zeile 2 bis 6 = Befüllung mit Namen<br />

'<strong>E<strong>in</strong></strong>trag des Teilnehmers <strong>in</strong> die<br />

entsprechende Zelle<br />

Case 7 '7.Zeile = Summ-formel für Zeilen 2 bis 6<br />

Worksheets(d + 2).Cells(zeile, spalte + 1).FormulaR1C1 =<br />

"=SUM(R[-5]C:R[-1]C)"<br />

Worksheets(d + 2).Cells(zeile, spalte +<br />

1).FormatConditions.Delete<br />

Worksheets(d + 2).Cells(zeile, spalte +<br />

1).FormatConditions.Add _<br />

Type:=xlCellValue, Operator:=xlNotEqual, Formula1:="0"<br />

With Worksheets(d + 2).Cells(zeile, spalte +<br />

1).FormatConditions(1).Font<br />

.Bold = True<br />

.Italic = False<br />

.ColorIndex = 3<br />

End With<br />

Worksheets(d + 2).Cells(zeile, spalte +<br />

1).FormatConditions(1).Interior.ColorIndex = 5<br />

Worksheets(d + 2).Cells(zeile, spalte +<br />

1).HorizontalAlignment = xlCenter<br />

End Select<br />

Next j<br />

i5t = i5t + 1 'nach Abarbeitung 5er-Tisch Zähler um 1<br />

erhöhen<br />

Else ... 'Abarbeitung der 4er-Tische nach dem<br />

gleichen Schema<br />

Sub ZelleMitNameFuellen()<br />

Dim Sp_Name As Str<strong>in</strong>g<br />

Dim MatchZeile As Variant<br />

Sp_Name = Worksheets(1).Range("M" & (Zuf_Nr(d, n))).Value 'Zeile aus<br />

Spalte "M" entspricht Zufallszahl<br />

Worksheets(d + 2).Cells(zeile, spalte) = Sp_Name<br />

'<strong>E<strong>in</strong></strong>tragung<br />

des Spielers <strong>in</strong> der Durchgangs-Tabelle<br />

Worksheets(d + 2).Cells(zeile, spalte).Locked = True 'entsprechende<br />

Zelle sperren<br />

Worksheets(d + 2).Cells(zeile, spalte).Borders.L<strong>in</strong>eStyle =<br />

xlCont<strong>in</strong>uous<br />

Worksheets(d + 2).Cells(zeile, spalte).HorizontalAlignment =<br />

xlCenter<br />

Worksheets(d + 2).Cells(zeile, spalte).Interior.ColorIndex = HGrFaSp<br />

Worksheets(d + 2).Cells(zeile, spalte + 1).Borders.L<strong>in</strong>eStyle =<br />

xlCont<strong>in</strong>uous<br />

Worksheets(d + 2).Cells(zeile, spalte + 1).HorizontalAlignment =<br />

xlCenter<br />

Worksheets(d + 2).Cells(zeile, spalte + 1).Interior.ColorIndex =<br />

HGrFaSp<br />

Worksheets(d + 2).Cells(n, 11).Value = Sp_Name 'zusätzlich<br />

den Namen <strong>in</strong> Spalte "K" der Durchgangstabelle e<strong>in</strong>tragen<br />

Worksheets(d + 2).Cells(n, 11).Locked = True<br />

'und die<br />

betreffende Zelle sperren<br />

Worksheets(d + 2).Cells(n, 12).Formula = "=R" & zeile & "C" & spalte<br />

+ 1 & "" 'außerdem die Punktzahl des Spielers automatisch übernehmen lassen<br />

Worksheets(d + 2).Cells(n, 12).Locked = True 'und auch diese Zelle<br />

(gleiche Zeile, aber Spalte "L"), sperren lassen<br />

MatchZeile = Application.Match(Sp_Name, Sheets(list).Range("A:A"), 0)<br />

'Spielernamen <strong>in</strong> Tabelle "Liste", Spalte "A" suchen<br />

If IsError(MatchZeile) Then 'falls noch nicht vorhanden<br />

lz = Sheets(list).Range("A" & Rows.Count).End(xlUp).Row + 1<br />

'neue Zeile "aufmachen"<br />

39

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!