Dear Users,
my goal is to copy all of the numbers from the "copyPaste" sheet to the other sheet which are between 41000000 and 42000000.
If I run the code below it only gives the last value that is between these two. (it is also very slow...)
Can you spot the mistake?
(since I am a rooky I would learn the most if there would be as many changes as it is necessary if you add to it.. the goal is mainly to know my mistake than realy get the values)
![]()
Sub ForEach() ActiveWorkbook.Worksheets("copypaste").Select Dim lastRow As Range Dim SelectRange As Range Dim cell As Range Set lastRow = Cells(Rows.Count, 3).End(xlUp) Set SelectRange = ActiveWorkbook.Worksheets("copypaste").Range("C3", lastRow) For Each cell In SelectRange If cell > 41000000 And cell < 42000000 Then cell.Copy ActiveWorkbook.Worksheets("forEach").Range("a" & Rows.Count).End(xlUp) End If Next cell Worksheets("forEach").Select End Sub
Thank you indeed for your time and help
please see attachment
Bookmarks