Hello Friends,
I am working on a macro where it should automatically compare value which is present in A column on one sheet with values in another sheet. If that particular value matches then it should automatically copy that row and paste in to another sheet whose sheet name is compared value.
Sub sats()
Dim s As Integer
A = Worksheets("PROJECT_DETAILS").Cells(Rows.Count, 1).End(xlUp).Row
B = Worksheets("TASK_DETAILS").Cells(Rows.Count, 1).End(xlUp).Row
For j = 5 To B
For I = 4 To A
If Worksheets("TASK_DETAILS").Cells(j, 1).Value = Worksheets("PROJECT_DETAILS").Cells(I, 1).Value Then
s = Worksheets("PROJECT_DETAILS").Cells(I, 1).Value
Worksheets("TASK_DETAILS").Rows(j).Copy
ThisWorkbook.Worksheets("s").Activate
c = Worksheets("s").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("s").Cells(c + 1, 1).Select
ActiveSheet.Paste
Worksheets("TASK_DETAILS").Activate
Else
End If
Next I
Next j
Application.CutCopyMode = False
End Sub
This is my code, if i run it , It is showing "subscript out of range" error. PLease help.
Bookmarks