Hi Expert,
Can you advise me on how to copied row if the combobox changed with BOTH then copied to new row.
Please find the attached file for your reference.
Many thanks in advance.
Rgds, Harto
Hi Expert,
Can you advise me on how to copied row if the combobox changed with BOTH then copied to new row.
Please find the attached file for your reference.
Many thanks in advance.
Rgds, Harto
[vba]
Private Sub CommandButton1_Click()
Dim Nrow As Integer
With Sheets(1)
Nrow = WorksheetFunction.CountA(.Range("B:B")) + 4
.Cells(Nrow, 1).Value = .Cells(Nrow - 1, 1).Value + 1
If ComboBox1.Value = "BOTH" Then
.Cells(Nrow, 2).Value = "AAAA"
.Cells(Nrow, 3).Value = TextBox2.Text
.Cells(Nrow, 4).Value = TextBox3.Text
.Cells(Nrow, 5).Value = TextBox4.Text
.Cells(Nrow, 6).Value = TextBox5.Text
Nrow = Nrow + 1
.Cells(Nrow, 1).Value = .Cells(Nrow - 1, 1).Value + 1
.Cells(Nrow, 2).Value = "BBBB"
.Cells(Nrow, 3).Value = TextBox2.Text
.Cells(Nrow, 4).Value = TextBox3.Text
.Cells(Nrow, 5).Value = TextBox4.Text
.Cells(Nrow, 6).Value = TextBox5.Text
Else
.Cells(Nrow, 2).Value = ComboBox1.Value
.Cells(Nrow, 3).Value = TextBox2.Text
.Cells(Nrow, 4).Value = TextBox3.Text
.Cells(Nrow, 5).Value = TextBox4.Text
.Cells(Nrow, 6).Value = TextBox5.Text
End If
Call getfocus
End With
End Sub
[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Thanks Bob.
Appreciate it so much.
Best, Harto