Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.visual.basic    |    MS Visual Basic discussions, NOT dot-net    |    10,840 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 9,208 of 10,840    |
|    Punky to All    |
|    Accessing newly created worksheet in Exc    |
|    11 Feb 05 09:37:21    |
   
   From: lindajakobs@wanadoo.nl   
      
   Hi all,   
   I've created a workbook to play a game with my friends. Each time I insert   
   results a new worksheet should be created (which happens) and then this   
   worksheet should be activated. I'm fairly new to VBA but have used object   
   oriented programming before.   
   The following code I created with the help of the build-in help file.   
      
      
    ' werkblad voor uitslag per race maken   
    ActiveWorkbook.Sheets.Add _   
    after:=Worksheets(Worksheets.Count)   
    iWerkbladen = Sheets.Count   
    Worksheets("Sheet" & iWerkbladen).Activate // this line is   
   listed as 'the problem'   
    ActiveSheet.Name = sRace   
    Range("A1").Text = "Deelnemer"   
    Range("B1").Text = "Punten"   
      
   The error message I get is: subscript out of range   
   Can any of you please tell me what I'm doing wrong and how to do it   
   correctly?   
   T.i.a.   
   --   
   Punky   
      
   Leven is leven dat leven wil te midden van leven dat leven wil (dr. A.   
   Schweitzer)   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca