stillwillyboy
Technical User
In a sales report showing invoices, debits, credits and related numbers and dollar amounts, I need to move the debits and credits to the bottom of the sheet and then delete the empty row that held the debit and/or credit. I can get the item moved, but then the cell (row) that received the pasting becomes the active cell and my loop gets messed up. After pasting, how do I get back to the next cell to see if it has a debit or credit? My code so far is below.
TIA,
Bill
Sub CutAndPasteDebitsAndCreditsToBottomOfBranchSheet()
Application.StatusBar = "Moving Debits and Credits"
Application.ScreenUpdating = False
Range("A1").Select
Do
If ActiveCell.Offset(0, 1) = "Credit Memo" Then
ActiveCell.EntireRow.Copy
Range("A65536").End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Else
ActiveCell.Offset(1, 0).Select
End If
Loop Until ActiveCell.Formula = "Grand Total"
Range("A1").Select
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Application.StatusBar = False
End Sub
TIA,
Bill
Sub CutAndPasteDebitsAndCreditsToBottomOfBranchSheet()
Application.StatusBar = "Moving Debits and Credits"
Application.ScreenUpdating = False
Range("A1").Select
Do
If ActiveCell.Offset(0, 1) = "Credit Memo" Then
ActiveCell.EntireRow.Copy
Range("A65536").End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Else
ActiveCell.Offset(1, 0).Select
End If
Loop Until ActiveCell.Formula = "Grand Total"
Range("A1").Select
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Application.StatusBar = False
End Sub