Hi,
I need help on following VBA. i am preparing voucher and have voucher-number in textbox1. sometime i need to have 3 debit entries (mean 3 times values in textbox 7) against one credit entry (textbox 8). i want to link value of textbox1 with textbox7 and 8. if there is value in textbox 7 or 8 then value of textbox1 should be posted in database sheet againt row of that filled textbox. if any of textbox(7 or 8) is empty, the value of textbox1 should not go in database against that empty textbox...
i don't know its explained or not

Private Sub DATA()
On Error GoTo err
Dim rw As Long
Dim ws As Worksheet
Set ws = Worksheets("Database")
 
rw = ws.Cells(Rows.Count, 2) _
.End(xlUp).Offset(1, 0).Row
    ws.Range("B" & rw) = TextBox1.Value
    ws.Range("C" & rw) = TextBox2.Value
    ws.Range("D" & rw) = ComboBox3.Value
    ws.Range("E" & rw) = TextBox4.Value
    ws.Range("F" & rw) = TextBox5.Value
    ws.Range("G" & rw) = TextBox6.Value
    ws.Range("H" & rw) = TextBox7.Value
   
    ws.Range("J" & rw) = TextBox9.Value

rw = ws.Cells(Rows.Count, 2) _
.End(xlUp).Offset(1, 0).Row
    
    ws.Range("B" & rw) = TextBox1.Value
    ws.Range("C" & rw) = TextBox2.Value
    ws.Range("D" & rw) = ComboBox4.Value
    ws.Range("E" & rw) = TextBox10.Value
    ws.Range("F" & rw) = TextBox11.Value
    ws.Range("G" & rw) = TextBox12.Value
    ws.Range("I" & rw) = TextBox8.Value * -1
    ws.Range("J" & rw) = TextBox9.Value
    TextBox13.Value = ws.Range("G2").Value
    
  Exit Sub
err:
TextBox13.Value = ws.Range("G2").Value
End Sub