RoVo1211
Gebruiker
- Lid geworden
- 24 feb 2024
- Berichten
- 114
- Besturingssysteem
- Windows 11
- Office versie
- Office 365
Bedankt voor je suggestie, maar ik snap niets van de code.
Jij bent een meer gevorderde programmeur dan ik. Daarbij komt dat ik de for...next-constructie altijd erg ingewikkeld vind.
Zou je de code van commentaar willen voorzien?
Waar ik de belangrijkste vraag over heb is
Het moeilijkste gedeelte vind ik
Wat gebeurt er hier?
Waarom is de eerste regel sn(5,2*j+13 en in de tweede regel sn(2*j+3,4)
Dit is de code die ik nu heb en ik snap dat jouw code veel korter is.
Jij bent een meer gevorderde programmeur dan ik. Daarbij komt dat ik de for...next-constructie altijd erg ingewikkeld vind.
Zou je de code van commentaar willen voorzien?
Waar ik de belangrijkste vraag over heb is
Code:
Me("chkDoel" & j).Caption = sn(2 * j + 3, 2)
Me("txtOpening" & j) = FormatCurrency(sn(5, 2 * j + 13))
Me("txtHuidig" & j) = FormatCurrency(sn(2 * j + 3, 4), 3)
Me("txtDoelProc" & j) = FormatPercent(sn(10, 2 * j + 13))
Me("txtDoel" & j) = FormatCurrency(sn(9, 2 * j + 13), 3)
Me("txtPer" & j) = FormatDateTime(sn(11, 2 * j + 13), 4)
Me("txtAankoop" & j) = FormatCurrency(sn(14, 2 * j + 13))
Me("txtVerk1Proc" & j) = FormatPercent(sn(14, 2 * j + 13) * 1.01)
Me("txtWinstXproc" & j) = FormatPercent(sn(43, 2 * j + 13))
Me("txtVerkXproc" & j) = FormatPercent(sn(14, 2 * j + 13) * (1 + sn(43, 2 * j + 13)))
Code:
sn(5, 2 * j + 13)
Waarom is de eerste regel sn(5,2*j+13 en in de tweede regel sn(2*j+3,4)
Dit is de code die ik nu heb en ik snap dat jouw code veel korter is.
Code:
With txtVerschilAEX
.Value = FormatNumber(Sheets(1).[M6].Value, 4)
Select Case txtVerschilAEX.Value
Case Is >= 0.05
.BackColor = RGB(0, 128, 0)
.ForeColor = vbWhite
Case Is >= 0.01
.BackColor = RGB(0, 192, 0)
.ForeColor = vbWhite
Case Is >= 0.005
.BackColor = RGB(192, 255, 192)
.ForeColor = vbBlack
Case Is >= 0.0001
.Font.Bold = False
.ForeColor = vbBlack
.BackColor = RGB(208, 255, 208)
Case Is >= -0.0001
.BackColor = RGB(0, 192, 255)
.ForeColor = vbYellow
Case Is >= -0.005
.BackColor = RGB(255, 224, 224)
.ForeColor = vbBlack
Case Is < 0.01
.BackColor = RGB(192, 255, 192)
.ForeColor = vbBlack
Case Is < 0.05
.BackColor = RGB(0, 192, 0)
.ForeColor = vbWhite
Case Else
End Select
End With