Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    part of string in Select case (2000 sr -1)

    i want to intercept the first left character in the Case Select... how to
    piece of code:

    Select Case TIP_SOSP

    Case "150008040030"
    FOGLIO = "1500_0804_0030"
    ULTIMA = Sheets(FOGLIO).Cells(65536, 1).End(xlUp).Row + 1
    GoTo IMPORTA
    Case "250008050030"
    FOGLIO = "2500_0805_0030"
    ULTIMA = Sheets(FOGLIO).Cells(65536, 1).End(xlUp).Row + 1
    GoTo IMPORTA
    *****************
    Case Left(1, 4) = "1500"
    FOGLIO = "1500"
    ULTIMA = Sheets(FOGLIO).Cells(65536, 1).End(xlUp).Row + 1
    GoTo IMPORTA
    ****************
    'Case "2500"
    ' FOGLIO = "2500"
    ' ULTIMA = Sheets(FOGLIO).Cells(65536, 1).End(xlUp).Row + 1
    ' GoTo IMPORTA
    'Case "3500"
    ' FOGLIO = "3500"
    ' ULTIMA = Sheets(FOGLIO).Cells(65536, 1).End(xlUp).Row + 1
    ' GoTo IMPORTA
    Case Else
    FOGLIO = "L0953"
    ULTIMA = Sheets(FOGLIO).Cells(65536, 1).End(xlUp).Row + 1
    GoTo IMPORTA

    End Select

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: part of string in Select case (2000 sr -1)

    Try this:

    Select Case TIP_SOSP
    Case "150008040030"
    FOGLIO = "1500_0804_0030"
    Case "250008050030"
    FOGLIO = "2500_0805_0030"
    Case Else
    Select Case Left(TIP_SOSP, 4)
    Case "1500"
    FOGLIO = "1500"
    Case "2500"
    FOGLIO = "2500"
    Case "3500"
    FOGLIO = "3500"
    Case Else
    FOGLIO = "L0953"
    End Select
    End Select
    ULTIMA = Sheets(FOGLIO).Cells(65536, 1).End(xlUp).Row + 1

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: part of string in Select case (2000 sr -1)

    Two select case in inetrnal is possible???
    WOW!!!!!!
    tks.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: part of string in Select case (2000 sr -1)

    Yes, you can nest a Select Case ... End Select within another one. The VBA help says
    <hr>Select Case statements can be nested. Each nested Select Case statement must have a matching End Select statement.<hr>

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: part of string in Select case (2000 sr -1)

    tks for suggestion

Posting Permissions

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