For Each Cell stopping after first

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,311
Office Version
  1. 2016
Platform
  1. Windows
I'm trying to copy data across to another sheet if a condition is met.

The condition is the value 'Unresolved' in column K - this is what I have so far;

Code:
Nextrow = Sheet14.Range("A65536").End(xlUp).Row + 1

For Each cell In Sheet7.Range("A2:A" & LastRow)
If cell.Offset(0, 10).Value = "Unresolved" Then
Sheet14.Range("A" & Nextrow).Value = cell.Offset(0, 2).Value
Sheet14.Range("B" & Nextrow).Value = cell.Offset(0, 3).Value
Sheet14.Range("C" & Nextrow).Value = cell.Offset(0, 6).Value
Sheet14.Range("D" & Nextrow).Value = cell.Offset(0, 7).Value
Sheet14.Range("E" & Nextrow).Value = cell.Offset(0, 8).Value
Sheet14.Range("F" & Nextrow).Value = cell.Offset(0, 9).Value
Sheet14.Range("G" & Nextrow).Value = cell.Offset(0, 10).Value
End If
Next

The issue is that is finds the first row where that condition is met and copies the data across fine, but stops there and does no more.

Can anyone advise where I am going wrong please?
 

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

MickG

MrExcel MVP
Joined
Jan 9, 2008
Messages
14,841
Your "Nextrow" line need to be in the loop after the "If" statement. !!!
 

footoo

Well-known Member
Joined
Sep 21, 2016
Messages
3,050
Office Version
  1. 2016
Platform
  1. Windows
Before the End if put : Nextrow=Nextrow+1
 

Watch MrExcel Video

Forum statistics

Threads
1,109,146
Messages
5,527,079
Members
409,743
Latest member
sukuto20

This Week's Hot Topics

Top