Code:
Dim d As Range
Dim c As Range
Dim j As Integer
Dim Source As Worksheet
Dim Target As Worksheet
Dim Condition As Worksheet
Set Source = ActiveWorkbook.Worksheets("Input")
Set Condition = ActiveWorkbook.Worksheets("Top20NoisiestDevices")
'This will start copying data to Target sheet at row 2
For Each d In Condition.Range("A2:A21") 'specifiy condition
'create wroksheet for each value in condition
Set Target = Sheets.Add(after:=ActiveSheet)
Target.Name = d.Value
j = 3
'add code to show client name on line A1
Sheets("Top20NoisiestDevices")(d.Value).Columns("E").Copy Target.Range("A1") '<--- causes the error I'm trying to copy the value in column E that corresponds to d.value in the condition sheet
Sheets("Input").Range("A1:G1").Copy Target.Range("A2")
For Each c In Source.Range("E2:E6893")
If Target.Name = d.Value And c.Value = d.Value Then
Source.Rows(c.Row).Copy Target.Rows(j)
j = j + 1
End If
Next c
Next d