my loop for Match only runs once why?

akram-5

Board Regular
Joined
Feb 25, 2012
Messages
123
Office Version
  1. 2019
Platform
  1. Windows
my loop for Match only runs once why?

For Each Serce In mySrange
Ctests = Serce
For Each Docser In myFrange
If Ctests = Docser Then
MsgBox Docser & Ctest & "is same"
Else
Sheets("Summary").Range("N" & yLstrow).Value = Ctests 'find next available cell in summary

End If

Next Docser

Next Serce
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Without seeing you whole code (so we can see what mySrange, myFrange, and yLstRow are set to), and without seeing what your data looks like, it is going to be very difficult to help you.

Also, when posting your code, please do not take a snapshot/image of it. We really cannot work with that. Use Copy/Paste and use the Code Tags.
See here: How to Post Your VBA Code
 
Upvote 0
SLstrow = Sheets("Users").Cells(Rows.Count, "G").End(xlUp).Offset(0, 0).Row
sStartrw = Sheets("Users").Range("G2").Row

hLstrow = Sheets("Users").Cells(Rows.Count, "E").End(xlUp).Offset(0, 0).Row
hStartrw = Sheets("Users").Range("E2").Row

mySrange = Sheets("Users").Range("G" & sStartrw, "G" & SLstrow)
myFrange = Sheets("Users").Range("E" & hStartrw, "E" & hLstrow)
For Each Serce In mySrange
Ctests = Serce
For Each Docser In myFrange
If Ctests = Docser Then
MsgBox Docser & Ctest & "is same"
Else
Sheets("Summary").Range("N" & yLstrow).Value = Ctests 'find next available cell in summary

End If

Next Docser
 
Upvote 0
Last row was outside the first loop. i briught it in. problem solved.
 
Upvote 0
Solution

Forum statistics

Threads
1,214,983
Messages
6,122,583
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top