Beste,
Ik heb 2 sub's aangemaakt. 1 sub controleert een BTW, waarbij vervolgens bij het toevoegen de variabele van sub 1 gebruikt wordt, om door te voeren in een cel van excel.
Dit is mijn code:
Het controleren werkt, maar het toevoegen blijft hangen op: Totaal en BTWTotaal. (Melding:Compileerfout, Variabele is niet gedefinieerd)
Hoe krijg ik dit opgelost?
Met vriendelijke groet,
Ramsje
Ik heb 2 sub's aangemaakt. 1 sub controleert een BTW, waarbij vervolgens bij het toevoegen de variabele van sub 1 gebruikt wordt, om door te voeren in een cel van excel.
Dit is mijn code:
Code:
Sub ControleerKnop_Click()
Dim AddLaagBTW, AddHoogBTW, AddTotaalBTW
Dim exclBTWLaag, Laag, BTWLaag
Dim exclBTWHoog, Hoog, BTWHoog
Dim exclBTWTotaal, Totaal, BTWTotaal
AddLaagBTW = AddLaagBTWTextBox.Value
AddHoogBTW = AddHoogBTWTextBox.Value
Laag = Round(AddLaagBTW / 106 * 100, 2)
Hoog = Round(AddHoogBTW / 121 * 100, 2)
Totaal = Round(Laag + Hoog, 2)
exclBTWLaag = Round(AddLaagBTW - Laag, 2)
exclBTWHoog = Round(AddHoogBTW - Hoog, 2)
exclBTWTotaal = Round(BTWLaag + BTWHoog, 2)
'Schrijf de waardes Excl BTW weg naar de textbox
CheckLaagBTWTextBox = Laag
CheckHoogBTWTextBox = Hoog
CheckTotaalBTWTextBox = Totaal
BTWLaag = Round(AddLaagBTW - Laag, 2)
BTWHoog = Round(AddHoogBTW - Hoog, 2)
BTWTotaal = BTWLaag + BTWHoog
End Sub
Sub ToevoegenKnop_Click()
Call ControleerKnop_Click
Dim emptyRow As Long
'Make Uitgave.Active
Uitgaven.Activate
'Determine EmptyRow
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
'Transfer Information
Cells(emptyRow, 1).Value = WinkelTextBox.Value
Cells(emptyRow, 2).Value = FactuurTextBox.Value
Cells(emptyRow, 4).Value = Totaal
Cells(emptyRow, 5).Value = AddTotaalBTWTextBox.Value
Cells(emptyRow, 6).Value = BTWTotaal
Cells(emptyRow, 7).Value = BetaalmethodeComboBox.Value
Cells(emptyRow, 8).Value = RekeningnummerComboBox.Value
Cells(emptyRow, 9).Value = BetaaldatumTextBox.Value
Unload Me
End Sub
Het controleren werkt, maar het toevoegen blijft hangen op: Totaal en BTWTotaal. (Melding:Compileerfout, Variabele is niet gedefinieerd)
Hoe krijg ik dit opgelost?
Met vriendelijke groet,
Ramsje
Laatst bewerkt: