Results 1 to 3 of 3

Thread: what does this statement do

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Posts
    3

    what does this statement do

    Can somebody please explain what the below line does:

    Worksheets.Add.Move after:=Worksheets(Worksheets.Count)

    Thank You.

  2. #2

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Posts
    3
    I just figured out what this statement does. I am new to MS programming. Sorry for the trouble.

  3. #3
    Fanatic Member WorkHorse's Avatar
    Join Date
    Jul 2002
    Location
    Where you live.
    Posts
    591
    The Move method is not needed inthis case because the dd method accepts an After parameter. The above code will add a sheet after the Activesheet (because no parameters are passed to the Add method) and then move the sheet to the end of the Sheets collection. If you watch close, you will see Excel flicker as it adds the sheet to the middle then moves it to the end. This gets the same result without the extra Move method:

    VB Code:
    1. Worksheets.Add After:=Worksheets(Worksheets.Count)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width