I am using the following code to copy data into a summary page....
Sub Summary()
Dim i As Integer
Dim myVal As String
On Error Resume Next
Application.DisplayAlerts = False
Worksheets("Summary").Delete
Application.DisplayAlerts = True
Worksheets.Add(Worksheets(1)).Name = "Summary"
For i = Worksheets("Start").Index + 1 To Worksheets("End").Index - 1
myVal = Worksheets(i).Range("P13").Text
If UCase(Mid(myVal, 2, 1)) = "x" Or myVal = "Dog" Then
Worksheets(i).Range("A1:a50").Copy _
Worksheets("Summary").Range("IV1").End(xlToLeft)(1, 2)
End If
Next i
End Sub
The values in A1:A50 are derived through a formula. The code works to the extent but I am getting #REF on the summary page. I know the problem is somehow related to the formulas in A1:A50 but I am not sure how to fix it.
Thanks for the help!
Sub Summary()
Dim i As Integer
Dim myVal As String
On Error Resume Next
Application.DisplayAlerts = False
Worksheets("Summary").Delete
Application.DisplayAlerts = True
Worksheets.Add(Worksheets(1)).Name = "Summary"
For i = Worksheets("Start").Index + 1 To Worksheets("End").Index - 1
myVal = Worksheets(i).Range("P13").Text
If UCase(Mid(myVal, 2, 1)) = "x" Or myVal = "Dog" Then
Worksheets(i).Range("A1:a50").Copy _
Worksheets("Summary").Range("IV1").End(xlToLeft)(1, 2)
End If
Next i
End Sub
The values in A1:A50 are derived through a formula. The code works to the extent but I am getting #REF on the summary page. I know the problem is somehow related to the formulas in A1:A50 but I am not sure how to fix it.
Thanks for the help!