Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DFS DFS is offline
external usenet poster
 
Posts: 5
Default 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.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default 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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert function dialog closes when I click a picture in Excel 2007 abhimanyu Excel Programming 0 December 16th 08 01:03 PM
Please-please-HELP - Really need this resolved - Allocation formul Chunkey Pandey Excel Worksheet Functions 4 November 24th 06 07:59 PM
when i insert word art in excel sheet excel file closes automatica marwin Excel Discussion (Misc queries) 1 April 10th 06 03:29 PM
is it a microsoft prob..can it be resolved or not? VbUser25 Excel Programming 0 January 31st 05 05:46 AM
I think I found a bug and need to kow how to get it resolved DMDiamond Setting up and Configuration of Excel 1 January 18th 05 12:32 AM


All times are GMT +1. The time now is 03:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"