Results 1 to 9 of 9

Select case within select case

Threaded View

  1. #1
    Registered User
    Join Date
    07-12-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    77

    Select case within select case

    Hello,


    I am trying to use a select case within another select case, to evaluate two different criteria ranges, but the second one doesn't seem to be working. Can anyone see why this might be?

    Thanks
    Rich



    Sub GULF()
    
        Sheets.Add.Name = "Gulf Debtors"
        
        'copy header row
        With Sheets("ORIGINAL DEBTORS")
        .Activate
        .Range("A1:CD1").Copy Destination:=Sheets("Gulf Debtors").Range("A1")
    
        n = 2
    
            For m = 2 To 30649
                Select Case .Cells(m, 15).Value
                Case "GC08", "GD22", "GD23", "GD24", "GD25"
                    .Range(.Cells(m, 1), .Cells(m, 82)).Copy Destination:=Sheets("Gulf Debtors").Cells(n, 1)
    
                Case Else
                Select Case .Cells(m, 23).Value
                Case "C001", "C003", "C018", "C061", "C077", "C109", "C176", "C177", "C189", "C228", "G128"
                    .Range(.Cells(m, 1), .Cells(m, 82)).Copy Destination:=Sheets("Gulf Debtors").Cells(n, 1)
    
                n = n + 1
                End Select
                End Select
                
            Next m
            End With
    
    
    End Sub
    Last edited by Richard Buttrey; 07-23-2013 at 05:30 AM. Reason: added code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Need the proper syntax to use Case/Select Case in vba properly.
    By rbion in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-16-2013, 02:34 PM
  2. [SOLVED] Disregard case in VBA code. (UCase, LCase, Select Case)
    By Orestees in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-07-2012, 12:12 PM
  3. Case Select compile error "Case without case select"
    By coasterman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-23-2012, 06:50 AM
  4. Case Select....The alternative method for long "Select Case"
    By kimyap in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2008, 01:24 AM
  5. [SOLVED] Select case / case is, multiple arguments
    By Werner Rohrmoser in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-03-2006, 07:00 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1