Hello all,
I have been searching and trying to code a specific macro for a couple of weeks now, and I'm agonisingly close but it falls down at the last hurdle. There seem to be a number of solutions to extremely similar problems on this forum, but none of them works for my specific requirements, and I'm seriously lacking the knowledge to debug and modify what I have to work.
I would very much appreciate someone having a quick look as I'm sure to the trained eye there is a simple error that should be easily rectified to anyone with more knowledge than me!
The brief.
I have a set of data with a decreasing variable. I want to create a macro that searches for a value of "0" in column G of one sheet, then cut the whole row, and then paste the whole row into the first empty row in another sheet in the same workbook.
Here is what I have so far:
It seems to fall down after the "With" Sheets("Completed Dedications")" so I'm suspecting something is wrong with my method of finding and pasting to the next blank row.
Can anyone point me in the right direction please??
Many thanks.
I have been searching and trying to code a specific macro for a couple of weeks now, and I'm agonisingly close but it falls down at the last hurdle. There seem to be a number of solutions to extremely similar problems on this forum, but none of them works for my specific requirements, and I'm seriously lacking the knowledge to debug and modify what I have to work.
I would very much appreciate someone having a quick look as I'm sure to the trained eye there is a simple error that should be easily rectified to anyone with more knowledge than me!
The brief.
I have a set of data with a decreasing variable. I want to create a macro that searches for a value of "0" in column G of one sheet, then cut the whole row, and then paste the whole row into the first empty row in another sheet in the same workbook.
Here is what I have so far:
Code:
Sub Find_Move_Zeros()
Dim LastRow As Long
On Error GoTo GetOut
Do
Range("G7:G10000").Select
Selection.Find(What:="0", After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
n = ActiveCell.Address
ActiveCell.EntireRow.Cut
With Sheets("Completed Dedications")
LastRow = .Range("G" & Rows.Count).End(xlUp).Row
.Range("A" & LastRow + 1).PasteSpecial xlPasteValues
End With
Sheets("Current Dedications").Activate
Loop
GetOut:
End Sub
It seems to fall down after the "With" Sheets("Completed Dedications")" so I'm suspecting something is wrong with my method of finding and pasting to the next blank row.
Can anyone point me in the right direction please??
Many thanks.