ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   exit sub after insert row (https://www.excelbanter.com/excel-programming/311604-exit-sub-after-insert-row.html)

Xiaoping Yao

exit sub after insert row
 
Hi the

Please help. The following code dosn't work. Similar code worked perfect
in other cases:

Private Sub MovetoClosedLoan()
Dim selr As Integer

'get selected row
selr = Selection.Row

'insert rows
Worksheets("ClosedLoan").Rows(11).Insert

'copy from loanpipeline to closed loan
Worksheets("LoanPipeLine").Rows(selr).Copy
Worksheets("ClosedLoan").Rows(11)

'delete from loanpipeline
Worksheets("LoanPipeLine").Rows(selr).Delete

'end of sub
End Sub

The execution will stop right after 'insert rows. The rest of the code will
not been executed and no error message.

Thanks.

Xiaoping



Mister T

exit sub after insert row
 
maybe if you step through your macro, you might find execution does not
actually stop. Instead, maybe your code

Worksheets("ClosedLoan").Rows(11)

is missing the paste method?

"Xiaoping Yao" wrote:

Hi the

Please help. The following code dosn't work. Similar code worked perfect
in other cases:

Private Sub MovetoClosedLoan()
Dim selr As Integer

'get selected row
selr = Selection.Row

'insert rows
Worksheets("ClosedLoan").Rows(11).Insert

'copy from loanpipeline to closed loan
Worksheets("LoanPipeLine").Rows(selr).Copy
Worksheets("ClosedLoan").Rows(11)

'delete from loanpipeline
Worksheets("LoanPipeLine").Rows(selr).Delete

'end of sub
End Sub

The execution will stop right after 'insert rows. The rest of the code will
not been executed and no error message.

Thanks.

Xiaoping




Mister T

exit sub after insert row
 
or rather pastespecial if applied to a range and paste if applied to the sheet

"Mister T" wrote:

maybe if you step through your macro, you might find execution does not
actually stop. Instead, maybe your code

Worksheets("ClosedLoan").Rows(11)

is missing the paste method?

"Xiaoping Yao" wrote:

Hi the

Please help. The following code dosn't work. Similar code worked perfect
in other cases:

Private Sub MovetoClosedLoan()
Dim selr As Integer

'get selected row
selr = Selection.Row

'insert rows
Worksheets("ClosedLoan").Rows(11).Insert

'copy from loanpipeline to closed loan
Worksheets("LoanPipeLine").Rows(selr).Copy
Worksheets("ClosedLoan").Rows(11)

'delete from loanpipeline
Worksheets("LoanPipeLine").Rows(selr).Delete

'end of sub
End Sub

The execution will stop right after 'insert rows. The rest of the code will
not been executed and no error message.

Thanks.

Xiaoping




Xiaoping Yao

exit sub after insert row
 
Checked my previous case involving the same code. Difference is my previous
worksheet doesn't have conditional formating and this one does. Took all
the conditional formating out and the code works perfect. But I do need the
conditional formatting. Seems to me whenever the conditinal formatting is
involved, any of insert and copy method will have trouble. How to get
around with this problem?

Xiaoping
"Xiaoping Yao" wrote in message
news:GBX5d.2944$Ok.2132@okepread04...
Hi the

Please help. The following code dosn't work. Similar code worked perfect
in other cases:

Private Sub MovetoClosedLoan()
Dim selr As Integer

'get selected row
selr = Selection.Row

'insert rows
Worksheets("ClosedLoan").Rows(11).Insert

'copy from loanpipeline to closed loan
Worksheets("LoanPipeLine").Rows(selr).Copy
Worksheets("ClosedLoan").Rows(11)

'delete from loanpipeline
Worksheets("LoanPipeLine").Rows(selr).Delete

'end of sub
End Sub

The execution will stop right after 'insert rows. The rest of the code

will
not been executed and no error message.

Thanks.

Xiaoping






All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com