Hi experts ,
I look for converting this code when copying from range to TABLE . the code will copy into two columns A,B based on selected optionbutton .
now I created TABLE1 for column A , TABLE2 for column B . so when select optionbutton1 and fill textbox1, then should copy in TABLE1(column A) , when select optionbutton2 and fill textbox1, then should copy in TABLE2(column B), when copying should be to the bottom .
here is the code I work on it.
thanks in advance
I look for converting this code when copying from range to TABLE . the code will copy into two columns A,B based on selected optionbutton .
now I created TABLE1 for column A , TABLE2 for column B . so when select optionbutton1 and fill textbox1, then should copy in TABLE1(column A) , when select optionbutton2 and fill textbox1, then should copy in TABLE2(column B), when copying should be to the bottom .
here is the code I work on it.
VBA Code:
Private Sub CommandButton1_Click()
Dim lr, lr1 As Long
Dim ws As Worksheet
Set ws = Sheets("sheet1")
lr = ws.Range("A" & Rows.Count).End(xlUp).Row
lr1 = ws.Range("B" & Rows.Count).End(xlUp).Row
With ws
If OptionButton1.Value = True Then Range("A" & lr + 1) = TextBox1.Value
If OptionButton2.Value = True Then Range("B" & lr1 + 1) = TextBox1.Value
End With
End Sub