thank you, that worked.
"Vergel Adriano" wrote:
> You need to qualify the Range object with varSheet and it's also better to
> declare varsheet as a worksheet object rather than variant. like this:
>
> Sub proTest()
> Dim varSheet As Worksheet
>
> For Each varSheet In Worksheets
> varSheet.Range("A1").Value = 22
> Next
>
> End Sub
>
>
>
> --
> Hope that helps.
>
> Vergel Adriano
>
>
> "rodchar" wrote:
>
> > hey all,
> > i found this snippet on the net but it doesn't seem to be working for me:
> >
> > Sub proTest()
> > Dim varSheet As Variant
> >
> > For Each varSheet In Worksheets
> > Range("A1").Value = 22
> > Next
> >
> > End Sub
> >
> > It only puts it into the current active sheet. can someone please tell me
> > how to run it for each sheet or what i'm doing wrong in the preceding snippet?
> >
> > thanks,
> > rodchar
|