Hi
I face problem, the right way if I select optionbutton 5(CASH) then should copy to column C (CASH) and if I select optionbutton 6(not paid) then should copy to column C (not paid) .
the code just copy (not paid) whether select optionbutton5 or 6 , how can I correct this problem experts ?
note: the problem just in this part of code otherwise everything is ok .
I face problem, the right way if I select optionbutton 5(CASH) then should copy to column C (CASH) and if I select optionbutton 6(not paid) then should copy to column C (not paid) .
the code just copy (not paid) whether select optionbutton5 or 6 , how can I correct this problem experts ?
note: the problem just in this part of code otherwise everything is ok .
VBA Code:
Private Sub CommandButton1_Click()
col = IIf(OptionButton3 = True, 4, 5)
With Sheets("" & Label30 & "")
nr = .Cells(.Rows.Count, 6).End(xlUp).Row + 1
Set Fnd = .Columns(2).Find(ComboBox1, .Columns(2).Cells(1), , , , xlPrevious)
If Fnd Is Nothing Then
Valu = 0
rw = nr
Else
Valu = .Range("F" & Fnd.Row).Value
rw = Fnd.Row + 1
End If
'.Rows (rw)
If col = 5 Then
.Range("B" & rw).Resize(, 5) = Array(ComboBox1, OptionButton5.Caption, TextBox6.Value, TextBox7.Value, Valu + Val(TextBox6.Value) - Val(TextBox7.Value))
Else
.Range("B" & rw).Resize(, 5) = Array(ComboBox1, OptionButton6.Caption, TextBox6.Value, TextBox7.Value, Valu + Val(TextBox6.Value) - Val(TextBox7.Value))
End If
With .Cells(1).CurrentRegion
.Offset(1).Resize(.Rows.Count - 1).Columns(1).Value = Date
End With
End With
End Sub