dans une cellule (A1) (feuille 2) j'aimerai faire la somme des cellules qui
comporte la lettre R dans une collone C feuille 1.
Pour compter mes jours de repos !
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Denis
Bonjour,
Merci le we fut bon
la fonction somme.si devrait faire l'affaire.
Alors au bouleau Cordialement Denis "L'embrouille" a écrit dans le message de news: O%
Bonjour ! Passer un bon W E ? Alors au boulot...
dans une cellule (A1) (feuille 2) j'aimerai faire la somme des cellules qui comporte la lettre R dans une collone C feuille 1. Pour compter mes jours de repos !
Dur ? Merci.
Bonjour,
Merci le we fut bon
la fonction somme.si devrait faire l'affaire.
Alors au bouleau
Cordialement
Denis
"L'embrouille" <sacaordures@free.fr> a écrit dans le message de news:
O%23EXzjIDHHA.4224@TK2MSFTNGP06.phx.gbl...
Bonjour !
Passer un bon W E ?
Alors au boulot...
dans une cellule (A1) (feuille 2) j'aimerai faire la somme des cellules
qui comporte la lettre R dans une collone C feuille 1.
Pour compter mes jours de repos !
Alors au bouleau Cordialement Denis "L'embrouille" a écrit dans le message de news: O%
Bonjour ! Passer un bon W E ? Alors au boulot...
dans une cellule (A1) (feuille 2) j'aimerai faire la somme des cellules qui comporte la lettre R dans une collone C feuille 1. Pour compter mes jours de repos !
Dur ? Merci.
Croy
Salut l'Embrouille,
Essaye voir ça :
Private Sub m_GetStartingGrid() ' ' Randomly select starting values ' Dim strStartValues As String Dim intSubGrid As Integer Dim intReveal As Integer Dim intIndex As Integer Dim intRow As Integer Dim intCol As Integer Dim intIndexRow As Integer Dim intIndexCol As Integer Dim intValue As Integer Dim rngDisplay As Range Dim rngStorage As Range
Set rngDisplay = m_AssignDisplay() Set rngStorage = m_AssignStorage()
Dim intNValues As Integer Dim intValueStack(81) As Integer Dim intNGrids As Integer Dim intGridStack(81) As Integer Dim intUseSubGrid As Integer Dim intAttemptCount As Integer
' create an array of 3 copies of each number Retry: intValue = 1 intNValues = 36 intNGrids = 36 intValue = 1 For intIndex = 1 To intNValues intValueStack(intIndex) = intValue intGridStack(intIndex) = intValue If intIndex Mod (intNValues / 9) = 0 Then intValue = intValue + 1 Next
ReDim blnReveal(9, 9) As Boolean ReDim intRevealCount(9) As Integer Dim intRevealGrid As Integer Dim intGameLevel As Integer
intGameLevel = (intNValues / 9) + 1 ' get first 34 values Do While intNGrids > 0 intUseSubGrid = m_GetRandom(1, intNGrids) intSubGrid = intGridStack(intUseSubGrid) If intRevealCount(intSubGrid) < intGameLevel Then Do intReveal = m_GetRandom(1, intNValues) intValue = intValueStack(intReveal) If Not blnReveal(intSubGrid, intValue) Then blnReveal(intSubGrid, intValue) = True intRevealCount(intSubGrid) = intRevealCount(intSubGrid) + 1 intValueStack(intReveal) = intValueStack(intNValues) intNValues = intNValues - 1 intGridStack(intUseSubGrid) = intGridStack(intNGrids) intNGrids = intNGrids - 1 intAttemptCount = 0 Exit Do Else intAttemptCount = intAttemptCount + 1 If intAttemptCount = 100 Then intAttemptCount = 0 GoTo Retry End If End If Loop Else intAttemptCount = intAttemptCount + 1 End If If intAttemptCount = 100 Then intAttemptCount = 0 GoTo Retry End If Loop
' get a set for remaining 5 values intNValues = 18 intNGrids = 18 intValue = 1 For intIndex = 1 To intNValues intValueStack(intIndex) = intValue intGridStack(intIndex) = intValue If intIndex Mod (intNValues / 9) = 0 Then intValue = intValue + 1 Next ' pick subgrids and values for remaining 5 places intGameLevel = m_GetRandom(5, 9) Do While intNGrids > (27 - intGameLevel) intUseSubGrid = m_GetRandom(1, intNGrids) intSubGrid = intGridStack(intUseSubGrid) If intRevealCount(intSubGrid) < 7 Then ' max 6 values in single grid Do intReveal = m_GetRandom(1, intNValues) intValue = intValueStack(intReveal) If Not blnReveal(intSubGrid, intValue) Then blnReveal(intSubGrid, intValue) = True intRevealCount(intSubGrid) = intRevealCount(intSubGrid) + 1 intValueStack(intReveal) = intValueStack(intNValues) intNValues = intNValues - 1 intGridStack(intUseSubGrid) = intGridStack(intNGrids) intNGrids = intNGrids - 1 Exit Do End If Loop End If Loop
m_ProtectPuzzle False For intSubGrid = 1 To 9 ' update storage grid by making start values BOLD ' update display grid by making start values visisble/bold and locked For intRow = 1 To 3 For intCol = 1 To 3 intIndexRow = ((m_GetSubGridRow(intSubGrid) - 1) * 3) + intRow intIndexCol = ((m_GetSubGridCol(intSubGrid) - 1) * 3) + intCol intValue = rngStorage.Cells(intIndexRow, intIndexCol).Value If blnReveal(intSubGrid, intValue) Then rngStorage.Cells(intIndexRow, intIndexCol).Font.Bold = True With rngDisplay.Cells(intIndexRow, intIndexCol) .Font.Bold = True .Locked = True .Value = rngStorage.Cells(intIndexRow, intIndexCol) End With Else rngStorage.Cells(intIndexRow, intIndexCol).Font.Bold = False With rngDisplay.Cells(intIndexRow, intIndexCol) .Font.Bold = False .Locked = False End With End If Next Next Next
'release Set rngStorage = Nothing Set rngDisplay = Nothing
End Sub
Je sais pas si ça marche, mais en tout cas tu pourras pas dire que j'ai pas bossé pour toi - Croy
Salut l'Embrouille,
Essaye voir ça :
Private Sub m_GetStartingGrid()
'
' Randomly select starting values
'
Dim strStartValues As String
Dim intSubGrid As Integer
Dim intReveal As Integer
Dim intIndex As Integer
Dim intRow As Integer
Dim intCol As Integer
Dim intIndexRow As Integer
Dim intIndexCol As Integer
Dim intValue As Integer
Dim rngDisplay As Range
Dim rngStorage As Range
Set rngDisplay = m_AssignDisplay()
Set rngStorage = m_AssignStorage()
Dim intNValues As Integer
Dim intValueStack(81) As Integer
Dim intNGrids As Integer
Dim intGridStack(81) As Integer
Dim intUseSubGrid As Integer
Dim intAttemptCount As Integer
' create an array of 3 copies of each number
Retry:
intValue = 1
intNValues = 36
intNGrids = 36
intValue = 1
For intIndex = 1 To intNValues
intValueStack(intIndex) = intValue
intGridStack(intIndex) = intValue
If intIndex Mod (intNValues / 9) = 0 Then intValue = intValue +
1
Next
ReDim blnReveal(9, 9) As Boolean
ReDim intRevealCount(9) As Integer
Dim intRevealGrid As Integer
Dim intGameLevel As Integer
intGameLevel = (intNValues / 9) + 1
' get first 34 values
Do While intNGrids > 0
intUseSubGrid = m_GetRandom(1, intNGrids)
intSubGrid = intGridStack(intUseSubGrid)
If intRevealCount(intSubGrid) < intGameLevel Then
Do
intReveal = m_GetRandom(1, intNValues)
intValue = intValueStack(intReveal)
If Not blnReveal(intSubGrid, intValue) Then
blnReveal(intSubGrid, intValue) = True
intRevealCount(intSubGrid) =
intRevealCount(intSubGrid) + 1
intValueStack(intReveal) =
intValueStack(intNValues)
intNValues = intNValues - 1
intGridStack(intUseSubGrid) =
intGridStack(intNGrids)
intNGrids = intNGrids - 1
intAttemptCount = 0
Exit Do
Else
intAttemptCount = intAttemptCount + 1
If intAttemptCount = 100 Then
intAttemptCount = 0
GoTo Retry
End If
End If
Loop
Else
intAttemptCount = intAttemptCount + 1
End If
If intAttemptCount = 100 Then
intAttemptCount = 0
GoTo Retry
End If
Loop
' get a set for remaining 5 values
intNValues = 18
intNGrids = 18
intValue = 1
For intIndex = 1 To intNValues
intValueStack(intIndex) = intValue
intGridStack(intIndex) = intValue
If intIndex Mod (intNValues / 9) = 0 Then intValue = intValue +
1
Next
' pick subgrids and values for remaining 5 places
intGameLevel = m_GetRandom(5, 9)
Do While intNGrids > (27 - intGameLevel)
intUseSubGrid = m_GetRandom(1, intNGrids)
intSubGrid = intGridStack(intUseSubGrid)
If intRevealCount(intSubGrid) < 7 Then ' max 6 values in
single grid
Do
intReveal = m_GetRandom(1, intNValues)
intValue = intValueStack(intReveal)
If Not blnReveal(intSubGrid, intValue) Then
blnReveal(intSubGrid, intValue) = True
intRevealCount(intSubGrid) =
intRevealCount(intSubGrid) + 1
intValueStack(intReveal) =
intValueStack(intNValues)
intNValues = intNValues - 1
intGridStack(intUseSubGrid) =
intGridStack(intNGrids)
intNGrids = intNGrids - 1
Exit Do
End If
Loop
End If
Loop
m_ProtectPuzzle False
For intSubGrid = 1 To 9
' update storage grid by making start values BOLD
' update display grid by making start values visisble/bold and
locked
For intRow = 1 To 3
For intCol = 1 To 3
intIndexRow = ((m_GetSubGridRow(intSubGrid) - 1) * 3) +
intRow
intIndexCol = ((m_GetSubGridCol(intSubGrid) - 1) * 3) +
intCol
intValue = rngStorage.Cells(intIndexRow,
intIndexCol).Value
If blnReveal(intSubGrid, intValue) Then
rngStorage.Cells(intIndexRow,
intIndexCol).Font.Bold = True
With rngDisplay.Cells(intIndexRow, intIndexCol)
.Font.Bold = True
.Locked = True
.Value = rngStorage.Cells(intIndexRow,
intIndexCol)
End With
Else
rngStorage.Cells(intIndexRow,
intIndexCol).Font.Bold = False
With rngDisplay.Cells(intIndexRow, intIndexCol)
.Font.Bold = False
.Locked = False
End With
End If
Next
Next
Next
'release
Set rngStorage = Nothing
Set rngDisplay = Nothing
End Sub
Je sais pas si ça marche, mais en tout cas tu pourras pas dire que
j'ai pas bossé pour toi - Croy
Private Sub m_GetStartingGrid() ' ' Randomly select starting values ' Dim strStartValues As String Dim intSubGrid As Integer Dim intReveal As Integer Dim intIndex As Integer Dim intRow As Integer Dim intCol As Integer Dim intIndexRow As Integer Dim intIndexCol As Integer Dim intValue As Integer Dim rngDisplay As Range Dim rngStorage As Range
Set rngDisplay = m_AssignDisplay() Set rngStorage = m_AssignStorage()
Dim intNValues As Integer Dim intValueStack(81) As Integer Dim intNGrids As Integer Dim intGridStack(81) As Integer Dim intUseSubGrid As Integer Dim intAttemptCount As Integer
' create an array of 3 copies of each number Retry: intValue = 1 intNValues = 36 intNGrids = 36 intValue = 1 For intIndex = 1 To intNValues intValueStack(intIndex) = intValue intGridStack(intIndex) = intValue If intIndex Mod (intNValues / 9) = 0 Then intValue = intValue + 1 Next
ReDim blnReveal(9, 9) As Boolean ReDim intRevealCount(9) As Integer Dim intRevealGrid As Integer Dim intGameLevel As Integer
intGameLevel = (intNValues / 9) + 1 ' get first 34 values Do While intNGrids > 0 intUseSubGrid = m_GetRandom(1, intNGrids) intSubGrid = intGridStack(intUseSubGrid) If intRevealCount(intSubGrid) < intGameLevel Then Do intReveal = m_GetRandom(1, intNValues) intValue = intValueStack(intReveal) If Not blnReveal(intSubGrid, intValue) Then blnReveal(intSubGrid, intValue) = True intRevealCount(intSubGrid) = intRevealCount(intSubGrid) + 1 intValueStack(intReveal) = intValueStack(intNValues) intNValues = intNValues - 1 intGridStack(intUseSubGrid) = intGridStack(intNGrids) intNGrids = intNGrids - 1 intAttemptCount = 0 Exit Do Else intAttemptCount = intAttemptCount + 1 If intAttemptCount = 100 Then intAttemptCount = 0 GoTo Retry End If End If Loop Else intAttemptCount = intAttemptCount + 1 End If If intAttemptCount = 100 Then intAttemptCount = 0 GoTo Retry End If Loop
' get a set for remaining 5 values intNValues = 18 intNGrids = 18 intValue = 1 For intIndex = 1 To intNValues intValueStack(intIndex) = intValue intGridStack(intIndex) = intValue If intIndex Mod (intNValues / 9) = 0 Then intValue = intValue + 1 Next ' pick subgrids and values for remaining 5 places intGameLevel = m_GetRandom(5, 9) Do While intNGrids > (27 - intGameLevel) intUseSubGrid = m_GetRandom(1, intNGrids) intSubGrid = intGridStack(intUseSubGrid) If intRevealCount(intSubGrid) < 7 Then ' max 6 values in single grid Do intReveal = m_GetRandom(1, intNValues) intValue = intValueStack(intReveal) If Not blnReveal(intSubGrid, intValue) Then blnReveal(intSubGrid, intValue) = True intRevealCount(intSubGrid) = intRevealCount(intSubGrid) + 1 intValueStack(intReveal) = intValueStack(intNValues) intNValues = intNValues - 1 intGridStack(intUseSubGrid) = intGridStack(intNGrids) intNGrids = intNGrids - 1 Exit Do End If Loop End If Loop
m_ProtectPuzzle False For intSubGrid = 1 To 9 ' update storage grid by making start values BOLD ' update display grid by making start values visisble/bold and locked For intRow = 1 To 3 For intCol = 1 To 3 intIndexRow = ((m_GetSubGridRow(intSubGrid) - 1) * 3) + intRow intIndexCol = ((m_GetSubGridCol(intSubGrid) - 1) * 3) + intCol intValue = rngStorage.Cells(intIndexRow, intIndexCol).Value If blnReveal(intSubGrid, intValue) Then rngStorage.Cells(intIndexRow, intIndexCol).Font.Bold = True With rngDisplay.Cells(intIndexRow, intIndexCol) .Font.Bold = True .Locked = True .Value = rngStorage.Cells(intIndexRow, intIndexCol) End With Else rngStorage.Cells(intIndexRow, intIndexCol).Font.Bold = False With rngDisplay.Cells(intIndexRow, intIndexCol) .Font.Bold = False .Locked = False End With End If Next Next Next
'release Set rngStorage = Nothing Set rngDisplay = Nothing
End Sub
Je sais pas si ça marche, mais en tout cas tu pourras pas dire que j'ai pas bossé pour toi - Croy
MichDenis
=NB.SI(Feuil1!$C1:$C;"R")
"L'embrouille" a écrit dans le message de news: O% Bonjour ! Passer un bon W E ? Alors au boulot...
dans une cellule (A1) (feuille 2) j'aimerai faire la somme des cellules qui comporte la lettre R dans une collone C feuille 1. Pour compter mes jours de repos !
Dur ? Merci.
=NB.SI(Feuil1!$C1:$C;"R")
"L'embrouille" <sacaordures@free.fr> a écrit dans le message de news:
O%23EXzjIDHHA.4224@TK2MSFTNGP06.phx.gbl...
Bonjour !
Passer un bon W E ?
Alors au boulot...
dans une cellule (A1) (feuille 2) j'aimerai faire la somme des cellules qui
comporte la lettre R dans une collone C feuille 1.
Pour compter mes jours de repos !
"L'embrouille" a écrit dans le message de news: O% Bonjour ! Passer un bon W E ? Alors au boulot...
dans une cellule (A1) (feuille 2) j'aimerai faire la somme des cellules qui comporte la lettre R dans une collone C feuille 1. Pour compter mes jours de repos !
Dur ? Merci.
L'embrouille
ouais génial ! Michdenis 1 point pour toi ! Merci "MichDenis" a écrit dans le message de news:
=NB.SI(Feuil1!$C1:$C;"R")
"L'embrouille" a écrit dans le message de news: O% Bonjour ! Passer un bon W E ? Alors au boulot...
dans une cellule (A1) (feuille 2) j'aimerai faire la somme des cellules qui comporte la lettre R dans une collone C feuille 1. Pour compter mes jours de repos !
Dur ? Merci.
ouais génial ! Michdenis 1 point pour toi !
Merci
"MichDenis" <michdenis@hotmail.com> a écrit dans le message de news:
e7CRP0IDHHA.4404@TK2MSFTNGP03.phx.gbl...
=NB.SI(Feuil1!$C1:$C;"R")
"L'embrouille" <sacaordures@free.fr> a écrit dans le message de news:
O%23EXzjIDHHA.4224@TK2MSFTNGP06.phx.gbl...
Bonjour !
Passer un bon W E ?
Alors au boulot...
dans une cellule (A1) (feuille 2) j'aimerai faire la somme des cellules
qui
comporte la lettre R dans une collone C feuille 1.
Pour compter mes jours de repos !
ouais génial ! Michdenis 1 point pour toi ! Merci "MichDenis" a écrit dans le message de news:
=NB.SI(Feuil1!$C1:$C;"R")
"L'embrouille" a écrit dans le message de news: O% Bonjour ! Passer un bon W E ? Alors au boulot...
dans une cellule (A1) (feuille 2) j'aimerai faire la somme des cellules qui comporte la lettre R dans une collone C feuille 1. Pour compter mes jours de repos !
Dur ? Merci.
etorria
Salut Einstein !
C'est pas ce qu'on demande !!!
"Croy" a écrit dans le message de news:
Salut l'Embrouille,
Essaye voir ça :
Private Sub m_GetStartingGrid() ' ' Randomly select starting values ' Dim strStartValues As String Dim intSubGrid As Integer Dim intReveal As Integer Dim intIndex As Integer Dim intRow As Integer Dim intCol As Integer Dim intIndexRow As Integer Dim intIndexCol As Integer Dim intValue As Integer Dim rngDisplay As Range Dim rngStorage As Range
Set rngDisplay = m_AssignDisplay() Set rngStorage = m_AssignStorage()
Dim intNValues As Integer Dim intValueStack(81) As Integer Dim intNGrids As Integer Dim intGridStack(81) As Integer Dim intUseSubGrid As Integer Dim intAttemptCount As Integer
' create an array of 3 copies of each number Retry: intValue = 1 intNValues = 36 intNGrids = 36 intValue = 1 For intIndex = 1 To intNValues intValueStack(intIndex) = intValue intGridStack(intIndex) = intValue If intIndex Mod (intNValues / 9) = 0 Then intValue = intValue + 1 Next
ReDim blnReveal(9, 9) As Boolean ReDim intRevealCount(9) As Integer Dim intRevealGrid As Integer Dim intGameLevel As Integer
intGameLevel = (intNValues / 9) + 1 ' get first 34 values Do While intNGrids > 0 intUseSubGrid = m_GetRandom(1, intNGrids) intSubGrid = intGridStack(intUseSubGrid) If intRevealCount(intSubGrid) < intGameLevel Then Do intReveal = m_GetRandom(1, intNValues) intValue = intValueStack(intReveal) If Not blnReveal(intSubGrid, intValue) Then blnReveal(intSubGrid, intValue) = True intRevealCount(intSubGrid) intRevealCount(intSubGrid) + 1 intValueStack(intReveal) intValueStack(intNValues) intNValues = intNValues - 1 intGridStack(intUseSubGrid) intGridStack(intNGrids) intNGrids = intNGrids - 1 intAttemptCount = 0 Exit Do Else intAttemptCount = intAttemptCount + 1 If intAttemptCount = 100 Then intAttemptCount = 0 GoTo Retry End If End If Loop Else intAttemptCount = intAttemptCount + 1 End If If intAttemptCount = 100 Then intAttemptCount = 0 GoTo Retry End If Loop
' get a set for remaining 5 values intNValues = 18 intNGrids = 18 intValue = 1 For intIndex = 1 To intNValues intValueStack(intIndex) = intValue intGridStack(intIndex) = intValue If intIndex Mod (intNValues / 9) = 0 Then intValue = intValue + 1 Next ' pick subgrids and values for remaining 5 places intGameLevel = m_GetRandom(5, 9) Do While intNGrids > (27 - intGameLevel) intUseSubGrid = m_GetRandom(1, intNGrids) intSubGrid = intGridStack(intUseSubGrid) If intRevealCount(intSubGrid) < 7 Then ' max 6 values in single grid Do intReveal = m_GetRandom(1, intNValues) intValue = intValueStack(intReveal) If Not blnReveal(intSubGrid, intValue) Then blnReveal(intSubGrid, intValue) = True intRevealCount(intSubGrid) intRevealCount(intSubGrid) + 1 intValueStack(intReveal) intValueStack(intNValues) intNValues = intNValues - 1 intGridStack(intUseSubGrid) intGridStack(intNGrids) intNGrids = intNGrids - 1 Exit Do End If Loop End If Loop
m_ProtectPuzzle False For intSubGrid = 1 To 9 ' update storage grid by making start values BOLD ' update display grid by making start values visisble/bold and locked For intRow = 1 To 3 For intCol = 1 To 3 intIndexRow = ((m_GetSubGridRow(intSubGrid) - 1) * 3) + intRow intIndexCol = ((m_GetSubGridCol(intSubGrid) - 1) * 3) + intCol intValue = rngStorage.Cells(intIndexRow, intIndexCol).Value If blnReveal(intSubGrid, intValue) Then rngStorage.Cells(intIndexRow, intIndexCol).Font.Bold = True With rngDisplay.Cells(intIndexRow, intIndexCol) .Font.Bold = True .Locked = True .Value = rngStorage.Cells(intIndexRow, intIndexCol) End With Else rngStorage.Cells(intIndexRow, intIndexCol).Font.Bold = False With rngDisplay.Cells(intIndexRow, intIndexCol) .Font.Bold = False .Locked = False End With End If Next Next Next
'release Set rngStorage = Nothing Set rngDisplay = Nothing
End Sub
Je sais pas si ça marche, mais en tout cas tu pourras pas dire que j'ai pas bossé pour toi - Croy
Salut Einstein !
C'est pas ce qu'on demande !!!
"Croy" <croy@tcag.ch> a écrit dans le message de news:
1164017176.715927.10000@h48g2000cwc.googlegroups.com...
Salut l'Embrouille,
Essaye voir ça :
Private Sub m_GetStartingGrid()
'
' Randomly select starting values
'
Dim strStartValues As String
Dim intSubGrid As Integer
Dim intReveal As Integer
Dim intIndex As Integer
Dim intRow As Integer
Dim intCol As Integer
Dim intIndexRow As Integer
Dim intIndexCol As Integer
Dim intValue As Integer
Dim rngDisplay As Range
Dim rngStorage As Range
Set rngDisplay = m_AssignDisplay()
Set rngStorage = m_AssignStorage()
Dim intNValues As Integer
Dim intValueStack(81) As Integer
Dim intNGrids As Integer
Dim intGridStack(81) As Integer
Dim intUseSubGrid As Integer
Dim intAttemptCount As Integer
' create an array of 3 copies of each number
Retry:
intValue = 1
intNValues = 36
intNGrids = 36
intValue = 1
For intIndex = 1 To intNValues
intValueStack(intIndex) = intValue
intGridStack(intIndex) = intValue
If intIndex Mod (intNValues / 9) = 0 Then intValue = intValue +
1
Next
ReDim blnReveal(9, 9) As Boolean
ReDim intRevealCount(9) As Integer
Dim intRevealGrid As Integer
Dim intGameLevel As Integer
intGameLevel = (intNValues / 9) + 1
' get first 34 values
Do While intNGrids > 0
intUseSubGrid = m_GetRandom(1, intNGrids)
intSubGrid = intGridStack(intUseSubGrid)
If intRevealCount(intSubGrid) < intGameLevel Then
Do
intReveal = m_GetRandom(1, intNValues)
intValue = intValueStack(intReveal)
If Not blnReveal(intSubGrid, intValue) Then
blnReveal(intSubGrid, intValue) = True
intRevealCount(intSubGrid) intRevealCount(intSubGrid) + 1
intValueStack(intReveal) intValueStack(intNValues)
intNValues = intNValues - 1
intGridStack(intUseSubGrid) intGridStack(intNGrids)
intNGrids = intNGrids - 1
intAttemptCount = 0
Exit Do
Else
intAttemptCount = intAttemptCount + 1
If intAttemptCount = 100 Then
intAttemptCount = 0
GoTo Retry
End If
End If
Loop
Else
intAttemptCount = intAttemptCount + 1
End If
If intAttemptCount = 100 Then
intAttemptCount = 0
GoTo Retry
End If
Loop
' get a set for remaining 5 values
intNValues = 18
intNGrids = 18
intValue = 1
For intIndex = 1 To intNValues
intValueStack(intIndex) = intValue
intGridStack(intIndex) = intValue
If intIndex Mod (intNValues / 9) = 0 Then intValue = intValue +
1
Next
' pick subgrids and values for remaining 5 places
intGameLevel = m_GetRandom(5, 9)
Do While intNGrids > (27 - intGameLevel)
intUseSubGrid = m_GetRandom(1, intNGrids)
intSubGrid = intGridStack(intUseSubGrid)
If intRevealCount(intSubGrid) < 7 Then ' max 6 values in
single grid
Do
intReveal = m_GetRandom(1, intNValues)
intValue = intValueStack(intReveal)
If Not blnReveal(intSubGrid, intValue) Then
blnReveal(intSubGrid, intValue) = True
intRevealCount(intSubGrid) intRevealCount(intSubGrid) + 1
intValueStack(intReveal) intValueStack(intNValues)
intNValues = intNValues - 1
intGridStack(intUseSubGrid) intGridStack(intNGrids)
intNGrids = intNGrids - 1
Exit Do
End If
Loop
End If
Loop
m_ProtectPuzzle False
For intSubGrid = 1 To 9
' update storage grid by making start values BOLD
' update display grid by making start values visisble/bold and
locked
For intRow = 1 To 3
For intCol = 1 To 3
intIndexRow = ((m_GetSubGridRow(intSubGrid) - 1) * 3) +
intRow
intIndexCol = ((m_GetSubGridCol(intSubGrid) - 1) * 3) +
intCol
intValue = rngStorage.Cells(intIndexRow,
intIndexCol).Value
If blnReveal(intSubGrid, intValue) Then
rngStorage.Cells(intIndexRow,
intIndexCol).Font.Bold = True
With rngDisplay.Cells(intIndexRow, intIndexCol)
.Font.Bold = True
.Locked = True
.Value = rngStorage.Cells(intIndexRow,
intIndexCol)
End With
Else
rngStorage.Cells(intIndexRow,
intIndexCol).Font.Bold = False
With rngDisplay.Cells(intIndexRow, intIndexCol)
.Font.Bold = False
.Locked = False
End With
End If
Next
Next
Next
'release
Set rngStorage = Nothing
Set rngDisplay = Nothing
End Sub
Je sais pas si ça marche, mais en tout cas tu pourras pas dire que
j'ai pas bossé pour toi - Croy
Private Sub m_GetStartingGrid() ' ' Randomly select starting values ' Dim strStartValues As String Dim intSubGrid As Integer Dim intReveal As Integer Dim intIndex As Integer Dim intRow As Integer Dim intCol As Integer Dim intIndexRow As Integer Dim intIndexCol As Integer Dim intValue As Integer Dim rngDisplay As Range Dim rngStorage As Range
Set rngDisplay = m_AssignDisplay() Set rngStorage = m_AssignStorage()
Dim intNValues As Integer Dim intValueStack(81) As Integer Dim intNGrids As Integer Dim intGridStack(81) As Integer Dim intUseSubGrid As Integer Dim intAttemptCount As Integer
' create an array of 3 copies of each number Retry: intValue = 1 intNValues = 36 intNGrids = 36 intValue = 1 For intIndex = 1 To intNValues intValueStack(intIndex) = intValue intGridStack(intIndex) = intValue If intIndex Mod (intNValues / 9) = 0 Then intValue = intValue + 1 Next
ReDim blnReveal(9, 9) As Boolean ReDim intRevealCount(9) As Integer Dim intRevealGrid As Integer Dim intGameLevel As Integer
intGameLevel = (intNValues / 9) + 1 ' get first 34 values Do While intNGrids > 0 intUseSubGrid = m_GetRandom(1, intNGrids) intSubGrid = intGridStack(intUseSubGrid) If intRevealCount(intSubGrid) < intGameLevel Then Do intReveal = m_GetRandom(1, intNValues) intValue = intValueStack(intReveal) If Not blnReveal(intSubGrid, intValue) Then blnReveal(intSubGrid, intValue) = True intRevealCount(intSubGrid) intRevealCount(intSubGrid) + 1 intValueStack(intReveal) intValueStack(intNValues) intNValues = intNValues - 1 intGridStack(intUseSubGrid) intGridStack(intNGrids) intNGrids = intNGrids - 1 intAttemptCount = 0 Exit Do Else intAttemptCount = intAttemptCount + 1 If intAttemptCount = 100 Then intAttemptCount = 0 GoTo Retry End If End If Loop Else intAttemptCount = intAttemptCount + 1 End If If intAttemptCount = 100 Then intAttemptCount = 0 GoTo Retry End If Loop
' get a set for remaining 5 values intNValues = 18 intNGrids = 18 intValue = 1 For intIndex = 1 To intNValues intValueStack(intIndex) = intValue intGridStack(intIndex) = intValue If intIndex Mod (intNValues / 9) = 0 Then intValue = intValue + 1 Next ' pick subgrids and values for remaining 5 places intGameLevel = m_GetRandom(5, 9) Do While intNGrids > (27 - intGameLevel) intUseSubGrid = m_GetRandom(1, intNGrids) intSubGrid = intGridStack(intUseSubGrid) If intRevealCount(intSubGrid) < 7 Then ' max 6 values in single grid Do intReveal = m_GetRandom(1, intNValues) intValue = intValueStack(intReveal) If Not blnReveal(intSubGrid, intValue) Then blnReveal(intSubGrid, intValue) = True intRevealCount(intSubGrid) intRevealCount(intSubGrid) + 1 intValueStack(intReveal) intValueStack(intNValues) intNValues = intNValues - 1 intGridStack(intUseSubGrid) intGridStack(intNGrids) intNGrids = intNGrids - 1 Exit Do End If Loop End If Loop
m_ProtectPuzzle False For intSubGrid = 1 To 9 ' update storage grid by making start values BOLD ' update display grid by making start values visisble/bold and locked For intRow = 1 To 3 For intCol = 1 To 3 intIndexRow = ((m_GetSubGridRow(intSubGrid) - 1) * 3) + intRow intIndexCol = ((m_GetSubGridCol(intSubGrid) - 1) * 3) + intCol intValue = rngStorage.Cells(intIndexRow, intIndexCol).Value If blnReveal(intSubGrid, intValue) Then rngStorage.Cells(intIndexRow, intIndexCol).Font.Bold = True With rngDisplay.Cells(intIndexRow, intIndexCol) .Font.Bold = True .Locked = True .Value = rngStorage.Cells(intIndexRow, intIndexCol) End With Else rngStorage.Cells(intIndexRow, intIndexCol).Font.Bold = False With rngDisplay.Cells(intIndexRow, intIndexCol) .Font.Bold = False .Locked = False End With End If Next Next Next
'release Set rngStorage = Nothing Set rngDisplay = Nothing
End Sub
Je sais pas si ça marche, mais en tout cas tu pourras pas dire que j'ai pas bossé pour toi - Croy
Croy
Salut Einstein !
C'est pas ce qu'on demande !!!
Sans blague, dis moi pas que j'ai oublié une parentèse quelque part
?... j'te croirais pas ! - Croy
Salut Einstein !
C'est pas ce qu'on demande !!!
Sans blague, dis moi pas que j'ai oublié une parentèse quelque part