Results 1 to 8 of 8

Thread: [RESOLVED] Select case Need help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2021
    Posts
    108

    Resolved [RESOLVED] Select case Need help

    Hello
    Code:
    Private Sub Text1_Change()
    Case 40
    Text2.Text = 1
    Case 41
    Text.Text = 2
    Text 42
    Text2.Text = 3
    .
    .
    .
    Case 60
    Text2.Text = 20
    End Select
    I want like this:

    Code:
    Private Sub Text1_Change()
    Select Case Text1.Text
    Case 40 To 60
    Dim i
    For i = 1 To 20
    Text2.Text = 1 + i
    Next i
    End Select
    End Sub
    but this not working
    Any help please
    Last edited by Adebiyi24; Mar 4th, 2021 at 12:07 PM.

  2. #2
    Hyperactive Member
    Join Date
    Jul 2020
    Posts
    370

    Re: Select case Need help

    You want to get numbers from 10 to 20 in Text2 ?

  3. #3
    PowerPoster
    Join Date
    Feb 2017
    Posts
    5,067

    Re: Select case Need help

    Explain what final result you are after (instead of what would you do).

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2021
    Posts
    108

    Re: Select case Need help

    Quote Originally Posted by Argus19 View Post
    You want to get numbers from 10 to 20 in Text2 ?
    yes sir

    I mean each time a number go up (increment) in textbox 1 ( 40 , 41, 42 ......60) same thing happens in textbox 2 ( 1, 2, 3, ......20)
    when I put 45 in textbox 1 , textbox 2 display 5

  5. #5
    Hyperactive Member
    Join Date
    Jul 2020
    Posts
    370

    Re: Select case Need help

    Code:
    Private Sub Text1_Change()
    Text2.Text = ""
    Select Case Text1.Text
    Case 40 To 60
    Text2.Text = Val(Text1.Text) - 40
    End Select
    End Sub

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2021
    Posts
    108

    Re: Select case Need help

    Thank you very much

  7. #7
    Hyperactive Member
    Join Date
    Jul 2020
    Posts
    370

    Re: Select case Need help

    This will be more correct:
    Code:
    Private Sub Text1_Change()
    Text2.Text = ""
    Select Case Val(Text1.Text)
    Case 40 To 60
    Text2.Text = Val(Text1.Text) - 40
    End Select
    End Sub

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Mar 2021
    Posts
    108

    Re: Select case Need help

    Thank you

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