Wheres the bug
Also testing the first two characters of a variable against a single
character does not seem smart. It will only succeed if myVal = F, in which
case you don't need the Left
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Bob Phillips" wrote in message
...
If needs a Then
If Left(myVal,2) = "F" Then
Worksheets(i).Select
Range("P10:p38").Copy
Worksheets("Summary").Select
Range("IV1").End(xlToLeft)(1, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues
Selection.PasteSpecial Paste:=xlPasteFormats
End If
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Catherine" wrote in message
...
Hi gang!
Here's my code
Sub summary2()
Application.ScreenUpdating = True
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 Left(myVal,2) = "F"
Then Worksheets(i).Select
Range("P10:p38").Copy
Worksheets("Summary").Select
Range("IV1").End(xlToLeft)(1, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues
Selection.PasteSpecial Paste:=xlPasteFormats
'End If
Next i
Im getting a syntax error on ....If Left(myVal,2) = "F"
Wheres the bug?
Thanks!
|