Displaying values on textbox

Hashiru

Active Member
Joined
May 29, 2011
Messages
286
Hi everyone

I am designing a data input form. I have the code developed so far:

.........................................................................................
code:

Private Sub CancelButton_Click()
Unload Me
End Sub

Private Sub OKButton_Click()
'Find the next row of the data sheet
nextrow = Worksheets("Bank Payment").Cells(Rows.Count, 1).End(xlUp).Row + 1
'Transfer data from ExpenseClassificationForm to worksheet

With Worksheets("Bank Payment")
.Cells(nextrow, 1).ClearFormats

On Error GoTo DateValidation
.Cells(nextrow, 1).Value = CDate(Me.DateText) 'CDate(Me.DateText)does the same thing as Format((Me.DateText), "dd/mm/yyyy") added below to achive the same result.
On Error GoTo 0

.Cells(nextrow, 2).Value = Me.ParticularsText
.Cells(nextrow, 3).Value = Me.ReferenceText
.Cells(nextrow, 4).Value = Format((Me.TBTotalAmount), "0.00")
End With




DateValidation:
MsgBox Prompt:="No date is entered for this transaction,Click on OK to continue or Click on Cancel to enter a date", Buttons:=vbOKCancel, Title:="Hashiru Chartered Certified Accountants"

If vbOK Then
Call UserFormReinitialization
End If
End Sub

Private Sub UserFormReinitialization()
Unload Me
ExpenseClassificationForm.Show
ExpenseClassificationForm.DateText.Value = " "
ExpenseClassificationForm.DateText.SetFocus
End Sub

Private Sub TBVATC0DE_Change()
On Error Resume Next
Me.TBvatAmount = Me.TBTotalAmount * Me.TBVATC0DE
Me.TBnetAmount = Me.TBTotalAmount - Me.TBvatAmount


End Sub

Private Sub UserForm_Initialize()

With TBVATC0DE
'Fill the VAT Code text Box
.AddItem "20%"
.AddItem "5%"
.AddItem "0%"
End With

TBVATC0DE.ListIndex = 0
End Sub

...............................................................................................
Request:

I want to develop the block of code to calculate the vat amount and the vat net amount and then show these amounts on the data input form.

With these, users of the form will only have to enter the total amount.

Vat calculation should be based on the total amount (on TBTotalAmount textbox) and the tax rate (selected on the text box TBVATCODE)

Net amount now being the difference between TBTotalAmount and TBVATCDE
...............................................................................................

Thanks in advance
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,224,599
Messages
6,179,827
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top