Clean up and Fix Two Macros

  • Thread starter Thread starter scottnshelly
  • Start date Start date
S

scottnshelly

I’ve got two macros. One loops to see if any cells in a range match
another cell. If so then it goes to another macro. My problem is, it
stops there. I need this to continue running until there are no more
matches.

For example, macro1 looks at two ranges, if there is a match it
immediately cuts to macro2. Macro2 does some copying and pasting and
stuff, then stops. How can I get them to continue?

Below is the code (I know it’s sloppy, I’m new to this). Any help is
appreciated. By the way, these do not necessarily need to be two
separate macros, that’s just the way I initially put it down.

Sub macro1()
'moves data from Data Entry (sheet1) to Summary (sheet5)
Application.ScreenUpdating = False
Sheet1.Select
Range("A1").Select

Do

If ActiveCell.Value = Sheet5.Range("b1").Value Then

ActiveCell.EntireRow.Copy

PasteOnsheet5

ActiveCell.Offset(1, 0).Select
Else

End If
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell) = True

Application.ScreenUpdating = True
End Sub

Sub PasteOnsheet5()
Application.ScreenUpdating = False
Sheet5.Select
Range("A5").Select

Do

If IsEmpty(ActiveCell) = False Then

ActiveCell.Offset(1, 0).Select

End If

Loop Until IsEmpty(ActiveCell) = True
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub
 
think you have to go back to sheet1 (correct cell) after you went t
sheet5 in PasteOnsheet
 
Back
Top