LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default Ending a macro?

I've got the following code working fine as a result of some wonderful
feedack from members., I just run the macro until it runs
out of data to find. The only problem is that when there is no more data to
find, the macro ends as an error. Is there any way of ending the macro
"cleanly"when there are no more entries?

Thanks again for the help.

Paul
Sub Pastedetails()

' Cutpaste Macro
' Macro recorded 22/11/2005 by IT Services
'
' Keyboard Shortcut: Ctrl+x

Sheets("Posting").Activate

x = Columns(3).Find("Reconciliations - Outstanding Items").Row
y = Columns(3).Find("Account Balance - Per master File").Row
z = Sheets("Posting").Cells(Rows.Count, "a").End(xlUp).Row + 1
Rows(x & ":" & y).Cut

Sheets("Summary").Activate
ActiveCell.SpecialCells (xlCellTypeLastCell)

ActiveSheet.Paste

Cells.Select
Cells.EntireColumn.AutoFit

Windows("Suspense1.xls").Activate
ActiveCell.SpecialCells(xlCellTypeLastCell).Offset (1, -5).Select

End Sub

 
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
Ending Macro in Last Row within a column of Printable Items MrMike Excel Worksheet Functions 7 April 7th 10 10:28 PM
Ending a macro early conditionally on one cell being blank Rokuro kubi Excel Discussion (Misc queries) 3 May 26th 06 02:09 PM
Ending zero RAB Excel Discussion (Misc queries) 3 August 25th 05 06:09 PM
Ending Looping Macro cparaske[_2_] Excel Programming 2 June 13th 05 09:27 PM
macro not ending Josie Excel Programming 3 October 6th 04 02:56 PM


All times are GMT +1. The time now is 01:56 AM.

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"