For Each ws In COM.Worksheets
A = COM.Worksheets(g).Range("A7").value
C = PA.Worksheets(g).Cells(2, Columns.Count).End(xlToLeft).Column
For B = C To 2 Step -1
If A = PA.Worksheets(g).Cells(B, "A").value Then
D = PA.Worksheets(g).Range(Cells(B, "A"), Cells(2, C))
E = B - 2
End If
Next B
I think you need to specify the sheet reference for both of those Cells objects...Code:D = PA.Worksheets(g).Range(Cells(B, "A"), Cells(2, C))
receiving an error on the above line, not sure what is causing it...
[table="width: 500"]
[tr]
[td]D = PA.Worksheets(g).Range(PA.Worksheets(g).Cells(B, "A"), PA.Worksheets(g).Cells(2, C))[/td]
[/tr]
[/table]
With PA.Worksheets(g)
D = .Range(.Cells(B, "A"), .Cells(2, C))
End WIth