Even a little shorter.

Public Sub SheetList()
  For i = 1 To Sheets.Count
    Cells(i, 1).Value = Sheets(i).Name
  Next i
End Sub


On Jul 3, 3:53 am, Swapnil Palande <swapnilp1...@gmail.com> wrote:
> Hi,
>
> Following is the correct code:
>
> Public Sub SheetList()
>
>    Range("A1").Select
>    For i = 1 To ActiveWorkbook.Sheets.Count
>        Cells(i, 1) = ActiveWorkbook.Sheets(i).Name
>    Next
>
> End Sub
>
> There is syntax error in your code in for loop
>
> And "ActiveWorkbook.Sheets.Count" this line will return integer
>
> Regards,
>
> Swapnil
>
>
>
> On Sat, Jul 3, 2010 at 12:22 AM, goofy_heron <bpascal...@gmail.com> wrote:
> > Hi,
>
> > Could you please tell me why this code is not working? From a
> > programming background, i see no reasons why the code is not giving
> > worksheets names through this for loop :
>
> > Option Explicit
>
> > Public Sub SheetList()
>
> >    Dim W As Worksheet
> >    Dim i As Integer
>
> >    Range("A1").Select
>
> >    For i = 1 To i = ActiveWorkbook.Sheets.Count
> >        Cells(i, 1) = W(i).Name
> >    Next i
>
> > End Sub
>
> > Pascal
>
> > --
>
> > ---------------------------------------------------------------------------­-------
> > Some important links for excel users:
> > 1. Follow us on TWITTER for tips tricks and links :
> >http://twitter.com/exceldailytip
> > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310
> > 3. Excel tutorials athttp://www.excel-macros.blogspot.com
> > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com
> > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com
>
> > To post to this group, send email to excel-macros@googlegroups.com
>
> > <><><><><><><><><><><><><><><><><><><><><><>
> > HELP US GROW !!
>
> > We reach over 7000 subscribers worldwide and receive many nice notes about
> > the learning and support from the group.Let friends and co-workers know they
> > can subscribe to group at
> >http://groups.google.com/group/excel-macros/subscribe- Hide quoted text -
>
> - Show quoted text -

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 7000 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to