home bbs files messages ]

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,276 of 10,840   
   Scott Beavers to All   
   Using "IF" Statement   
   11 Mar 05 10:57:55   
   
   From: sbeavers@aasurveying.com   
      
   I'm trying to create a form in Excel to sort from the form and take the data   
   to another worksheet.   
   I am very new to this and any help would be appreciated.   
      
   I have a value in a cell that will direct what sheet I want the cells copied   
   to, so I thought I could use an If statement but have been unable to right   
   the code properly, ie...   
      
   If "f2" = 1 Then   
        Sheets("XX1").Select   
        Range("A2").Select   
        ActiveSheet.Paste   
      
   Else   
       If "f2" = 2 Then   
        Sheets("XX2").Select   
        Range("A2").Select   
        ActiveSheet.Paste   
      
   Else   
       If "f2" = 3 Then   
        Sheets("XX3").Select   
        Range("A2").Select   
        ActiveSheet.Paste   
      
   Else   
       If "f2" = 4 Then   
        Sheets("XX4").Select   
        Range("A2").Select   
        ActiveSheet.Paste   
      
   Else   
       If "f2" = 5 Then   
        Sheets("XX5").Select   
        Range("A2").Select   
        ActiveSheet.Paste   
      
   End If   
      
   --- 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