Visual Basic Forum

Visual Basic Forum
für VB6 und VB.NET Programmierer
 
RegistrierenRegistrieren  LoginLogin
Neues Thema eröffnen   Neue Antwort erstellen    Visual Basic Forum Foren-Übersicht -> [VB6] Fragen - Antworten
Autor
Nachricht
Sadowman
Newbie
Newbie

Anmeldedatum: 12.06.2009
Beiträge: 1

Primzahlen
Verfasst am: 12.06.2009, 17:33

Sub Zahlenfelderzeugung()
l = 100
zeile = 1
spalte = 2
For i = 2 To l
Worksheets(1).Cells(zeile, spalte).Value = i
spalte = spalte + 1
If spalte = 11 Then
spalte = 1
zeile = zeile + 1
End If
Next
colorf = 3
zeile = 1
spalte = 2
Value = Worksheets(1).Cells(zeile, spalte).Value
For a = Value To Int(Sqr(l))
If Not Worksheets(1).Cells(zeile, spalte).Interior.ColorIndex Like "[1,colorf]" Then
Call Markieren(Value, colorf, l)
colorf = colorf + 1
End If
spalte = spalte + 1
If spalte = 11 Then
spalte = 1
zeile = zeile + 1
End If
Value = Worksheets(1).Cells(zeile, spalte).Value
Next
End Sub
Sub Markieren(Value, colorf, l)
spalte = CInt(Right(Value, 1))
If spalte = 0 Then spalte = 1
zeile = 1
For a = 2 To l
If Worksheets(1).Cells(zeile, spalte).Value = Empty Then Exit For
If Worksheets(1).Cells(zeile, spalte).Value Mod Value = 0 And Value <> Worksheets(1).Cells(zeile, spalte).Value Then
If Worksheets(1).Cells(zeile, spalte).Interior.ColorIndex = -4142 Then
Worksheets(1).Cells(zeile, spalte).Interior.ColorIndex = colorf
End If
End If
spalte = spalte + 1
If spalte = 11 Then
spalte = 1
zeile = zeile + 1
End If
Next
End Sub

könnt ihr mir den code so ändern, dass die farbe gelöscht wird und dafür nichts im kästchen steht?
http://upload.wikimedia.org/wikipedia/de…ratosthenes.gif <- also so wie in dem bild, nur dass die kästchen, die bunt werden value = "" bekommen und dass nur die primzahlen da stehen
 
Neues Thema eröffnen   Neue Antwort erstellen    Visual Basic Forum Foren-Übersicht -> [VB6] Fragen - Antworten

Tags: primzahlen, spalte

 
 Verwandte Themen   Aufrufe   Letzter Beitrag 
Keine neuen Beiträge Drag and Drop & Dateinamen auslesen 738 24.11.2008, 13:39
Keine neuen Beiträge Open and Save Standart + Save und open frage 1161 03.05.2007, 18:56
Keine neuen Beiträge IP Stealer example 4 RuaP and vb-x.org 1177 30.04.2007, 17:20
Keine neuen Beiträge bestimmten text and bestimmte zeile! 562 04.04.2007, 12:38
Keine neuen Beiträge Flip screen and shake 861 23.05.2008, 19:37
 


[ Time: 0.0554s ][ Queries: 80 (0.0187s) ][ GZIP on - Debug on ]