G
Guest
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
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