Hi Can anyone give me the code for a userform command button to Save data to a worksheet & Close a userform at the same time.
I have re posted this as I inadvertently posted it in the Access forum earlier
Hi Can anyone give me the code for a userform command button to Save data to a worksheet & Close a userform at the same time.
I have re posted this as I inadvertently posted it in the Access forum earlier
This saves the workbook and closes it
[vba]
sub closewrk()
ActiveWorkbook.SaveAs Filename:= "Myname.xls"
Activeworkbook.Close False
end sub
[/vba]
You can create a button and assign this macro to it.
kroz
I don't want to close the workbook. What i have is a userform called Employees with another pop up userform to add additional Employees who aren't in the combobox on the Employee userform. What I want to be able to do is save the data entered into the popup userform to the worksheet and clear the data from the popup userform and close and return to the main Employees userform
close a user form:
try:
userformname.hide
userformname.visible = false
unload userformname