Solved: Excel 2003 VBA - Run time error 9 Hey guys,
I have one worksheet called Consumption with a list of clients. I need to filter the data by building type and copy the data from this worksheet to a worksheet for each building type. The building types are in column E and the entries start at line 12. The different types possible are listed in column E above the entries. For this particular example I need the first one in E1. Here is the code I have in VBA
Sub PasteToCustSheet(OfficeBuildings)
Dim C As Range
Sheets("Consumption").Activate
For Each C In Range(Range("E12"), Range("A65536").End(xlUp))
If C.Value = Range("E1").Value Then
C.EntireRow.Copy
ActiveSheet.Paste ThisWorkbook.Sheets(C.Value).Range("a65536").End(xlUp).Offset(1, 0)
End If
Next
Application.CutCopyMode = False
End Sub
It keeps giving me a runtime error 9 and highlighting the first line but OfficeBuildings is the name of one of the sheets I need the information to go to. How do I fix this? |