excelnoob001
New Member
- Joined
- Jul 24, 2019
- Messages
- 26
Hi all,
Context: I have three error-checking columns in source file, worksheet "MrExcel". If there is a Y in any of the columns, goto columns A and B. If columns A and B matches with columns A and B of master file, worksheet "MrExcel", highlight cell A1 in that master file
An example: Let say in source file, worksheet "MrExcel", column M, row 8, (M8) there is a Y. Goto range A8 and B8 and check if they match range A8 and B8 of master file, worksheet "MrExcel".
Hope everything makes sense
.
Any help or insight is greatly appreciated.
Thanks!
Context: I have three error-checking columns in source file, worksheet "MrExcel". If there is a Y in any of the columns, goto columns A and B. If columns A and B matches with columns A and B of master file, worksheet "MrExcel", highlight cell A1 in that master file
Rich (BB code):
Private Sub loopIfY()
Dim lastRow As Long, i As Long
lastRow = Cells(rows.Count, "M").End(xlUp).Row
For i = 7 To lastRow 'checks from M7 to last row
If Cells(i, "M").Value = "Y" Then 'if it has letter Y
'code here
End If
Next i
For i = 7 To lastRow 'checks from M7 to last row
If Cells(i, "T").Value = "Y" Then 'if it has letter Y
'code here
End If
Next i
For i = 7 To lastRow 'checks from M7 to last row
If Cells(i, "AA").Value = "Y" Then 'if it has letter Y
'code here
End If
Next i
End Sub
An example: Let say in source file, worksheet "MrExcel", column M, row 8, (M8) there is a Y. Goto range A8 and B8 and check if they match range A8 and B8 of master file, worksheet "MrExcel".
Hope everything makes sense

Any help or insight is greatly appreciated.

Thanks!
Last edited: