Private Sub CommandButton1_Click()
Dim rowCount As Long
'Range("A2")=UserForm1.TextBox1.Value
'Range("B2")=UserForm1.ComboBox1.Value
'Range("C2")=UserForm1.TextBox2.Value
'Range("D2")=UserForm1.TextBox3.Value
'Range("E2")=UserForm1.ComboBox2.Value
'Range("F2")=UserForm1.OptionButton1.Value
'Range("G2") UserForm1.OptionButton2.Value
'Range("H2")=UserForm1.OptionButton3.Value
rowCount = Sheets("Data").Range("A2").CurrentRegion.Rows.Count
With Sheets("Data").Range("A2")
.Offset(rowCount, 0) = Now
.Offset(rowCount, 1) = UserForm1.TextBox1.Value
.Offset(rowCount, 2) = UserForm1.ComboBox1.Value
.Offset(rowCount, 3) = UserForm1.TextBox2.Value
.Offset(rowCount, 4) = UserForm1.TextBox3.Value
.Offset(rowCount, 5) = UserForm1.ComboBox2.Value
If UserForm1.OptionButton1.Value Then
Sheets("Data").Cells(nextrow, 6) = "CITY"
If UserForm1.OptionButton2.Value Then
Sheets("Data").Cells(nextrow, 7) = "TALUKA"
If UserForm1.OptionButton3.Value Then
Sheets("Data").Cells(nextrow, 8) = "TANKARA"
End If
.Offset(rowCount, 6) = UserForm1.OptionButton1.Value
.Offset(rowCount, 7) = UserForm1.OptionButton2.Value
.Offset(rowCount, 8) = UserForm1.OptionButton3.Value
End With
Unload UserForm1
End Sub
yogeshsinh.chauhan 0 Newbie Poster
Klahr_R 0 Newbie Poster
Reverend Jim 4,968 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.