Copy an entire row from sheet 2 which contains any value from column A on sheet 1

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Copy an entire row from sheet 2 which contains any value from column A on sheet 1



I would like to be able to copy any row from sheet 2 which contains any value from column a in sheet 1. I so far have this code but keep getting subscript out of range errors. Any help would greatly be appreciated. Thanks


Sub test()
Dim MyCell As Range, MyRange As Range
Dim row_counter As Long, col_counter As Long

Set MyRange = Sheets(“Sheet1”).Range("A1")

For Each MyCell In MyRange
If Cell.Value = MyCell.Value Then
Cell.EntireRow.Copy
End If

Next MyCell
End Sub





Do you mean If MyCell.Value = MyRange.Value? There is no variable here defined as Cell so something is off in your If statement
– urdearboy
Aug 12 at 15:59



If MyCell.Value = MyRange.Value


Cell


If





Do you understand that you're iterating over single cell?
– JohnyL
Aug 12 at 17:45





Also you're doing .copy but not .paste ...
– Marcucciboy2
Aug 13 at 13:28


.copy


.paste









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard