![]() |
UserForm closes after Selection.Insert (RESOLVED)
Excel 2003
I have a form with a button that inserts one row. As soon as the Insert executes, the form closes and the code quits. i = ActiveCell.Row Rows(i + 1).Select Selection.Insert I also tried: Rows(i + 1).Insert on the last line, and no dice. Resolution: close the sheet and reopen and it works. Lesson learned: Excel sometimes works in mysterious ways. |
UserForm closes after Selection.Insert (RESOLVED)
The only way the form iwll close if there is code that does this or there is
an Error. I recommend doing two things 1) In VBA menu change the option tools - Option - General - Error trapping - Break on All Errors 2) Comment out all 'On Error" statements until you get the code working. The error trapping could be shtting down the userform. You now should be able to find the problem and fix the problem. "DFS" wrote: Excel 2003 I have a form with a button that inserts one row. As soon as the Insert executes, the form closes and the code quits. i = ActiveCell.Row Rows(i + 1).Select Selection.Insert I also tried: Rows(i + 1).Insert on the last line, and no dice. Resolution: close the sheet and reopen and it works. Lesson learned: Excel sometimes works in mysterious ways. |
UserForm closes after Selection.Insert (RESOLVED)
change this
i = ActiveCell.Row Rows(i + 1).Select Selection.Insert TO i = ActiveCell.Row activesheet.rows(i).Insert "DFS" wrote: Excel 2003 I have a form with a button that inserts one row. As soon as the Insert executes, the form closes and the code quits. i = ActiveCell.Row Rows(i + 1).Select Selection.Insert I also tried: Rows(i + 1).Insert on the last line, and no dice. Resolution: close the sheet and reopen and it works. Lesson learned: Excel sometimes works in mysterious ways. |
All times are GMT +1. The time now is 01:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com