Hello,
So I am very much a VBA noob, I cobbled something together from snippets and tutorials online and it worked. Very simply it does a lookup in a table to find a value that matches my input, and then copies that row into another sheet. It worked perfectly up until this morning when it suddenly started throwing match errors. I haven't made any changes to it so I am very confused. The code is as follows: |
Code
Sub CopyYes()
Dim c As Range
Dim j As Integer
Dim Source As Worksheet
Dim Target As Worksheet
lookupvalue = ActiveWorkbook.Sheets("ModifyAsset").Range("L5").Value
' Change worksheet designations as needed
Set Source = ActiveWorkbook.Worksheets("AssetRegister")
Set Target = ActiveWorkbook.Worksheets("ModifyAssetDump")
j = 1 ' Start copying to row 1 in target sheet#
For Each c In Source.Range("AX1:AX10000")
If c = lookupvalue Then ##### THIS IS THE LINE HIGHLIGHTED WITH A MATCH ERROR ####
Source.Rows(c.Row).Copy Target.Rows(j)
j = j + 1
End If
Next c
Display More
If anyone has any ideas on what might have gone wrong here I would really appreciate it! Happy to provide more information etc. as needed, wasn't sure how much info to start off with here. |