Mark Dev
12/14/2006 3:07:00 PM
Keri,
Try activating the worksheet before performing the Select.
If IsNumeric(Right(ws.Name, Len(ws.Name) - 7)) Then
ws.Activate
ws.Range("A1").Select
End If
Regards,
Mark
"keri" <keri.dowson@diageo.com> wrote in message
news:1166108314.873124.113940@f1g2000cwa.googlegroups.com...
>I can't understand what i am doing wrong with this code. Obviously the
> first part of the code is for all sheets named "cardata" & integer.
> After this first part I want to select "a1" in these sheets to run the
> code that follows. However my line starting Range causes an error.
>
> Dim ws As worksheet
> For Each ws In ActiveWorkbook.Worksheets
> If UCase(Left(ws.Name, 7)) = "CARDATA" Then
> If IsNumeric(Right(ws.Name, Len(ws.Name) - 7)) Then
> Range("a1").Select
>
> I would appreciate help but also an explanationa s to why I can't start
> this line of code with Range.
>
> Thanks.
>