i = ActiveWorkbook.Sheets.Count Does ActiveWorkbook.Sheets.Count return an integer or a pointer to an object in which case i can't be of both type. Then how "for i ..." should be ?
Thx Pascal On Jul 3, 4:20 am, Dave Bonallack <davebonall...@hotmail.com> wrote: > Hi, > I don't think you can say "For i = 1 to i" since i is undefined. > Regards - Dave > > > > > Date: Fri, 2 Jul 2010 11:52:06 -0700 > > Subject: $$Excel-Macros$$ First sips of Vba for Excel : Worksheet listing > > From: bpascal...@gmail.com > > To: excel-macros@googlegroups.com > > > 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 > > athttp://groups.google.com/group/excel-macros/subscribe > > _________________________________________________________________ > Browse profiles for FREE! Meet local singles > online.http://clk.atdmt.com/NMN/go/150855801/direct/01/ -- ---------------------------------------------------------------------------------- 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