Hello Everyone!
I have a Userform.Which is working perfectly to send data to excel sheet.
In the userform there is command button (commandbutton1) which is used to send data to excel sheet...This only send data but it actually does not save it into excel sheet.When I close excel sheet it asks do you want to save changes?
But I need when commandbutton1 is press to send data to excel sheet , it should actually save data into excel sheet.
Here is code
Private Sub CommandButton1_Click()
Dim RowCount As Long
Dim ctl As Control
If Me.ComboBox1.Value = "" Then
MsgBox "Please Select Year", vbExclamation, " UserForm1"
Me.ComboBox1.SetFocus
Exit Sub
End If
If Me.ComboBox2.Value = "" Then
MsgBox "Please Select Exam Session.", vbExclamation, "UserForm1"
Me.ComboBox2.SetFocus
Exit Sub
End If
If Me.TextBox1.Value = "" Then
MsgBox "Please enter Registration number.", vbExclamation, "UserForm1"
Me.TextBox1.SetFocus
Exit Sub
End If
RowCount = Worksheets("Sheet1").Range("A1").CurrentRegion.Rows.Count
With Worksheets("Sheet1").Range("A1")
.Offset(RowCount, 0).Value = Me.ComboBox1.Value
.Offset(RowCount, 1).Value = Me.ComboBox2.Value
.Offset(RowCount, 2).Value = Me.TextBox1.Value
End With
End Sub
Plz Help
Kind Regards
z-eighty2
Bookmarks