Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CONTROLL ON SCROLL BAR... (2000 sr 1)

    I have inserted a controll on a scroll bar:

    If Cells(ScrollBar1.Value + 6, 4) = "C/C" Then
    'init list
    MsgBox "INIZIO ELENCO, IMPOSSIBILE PROSEGUIRE!", , "ATTENZIONE..."
    Exit Sub
    End If
    If Cells(ScrollBar1.Value + 6, 6) = "" Then
    'end list
    MsgBox "FINE ELENCO, IMPOSSIBILE PROSEGUIRE!", , "ATTENZIONE..."
    Exit Sub
    End If

    but it not work, WHY...

    if you have another way is welcone

    www.gssitaly.com/l0785_def.zip

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: CONTROLL ON SCROLL BAR... (2000 sr 1)

    Where is this code located (in what kind of module?) if it is the code module behind a worksheet, precede the "Scrollbar1" with the Me identifier to tell VBA the scrollbar is on the worksheet:

    Me.Scrollbar1 +6
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: CONTROLL ON SCROLL BAR... (2000 sr 1)

    In that case you need the Me prefix:

    Me.Scrollbar1
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

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

    Re: CONTROLL ON SCROLL BAR... (2000 sr 1)

    the code is located on form indirizzario

    i have insert a link to dowload my project to the top of my first post
    http://www.gssitaly.com/l0785_def.zip

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

    Re: CONTROLL ON SCROLL BAR... (2000 sr 1)

    where i insert this line?

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: CONTROLL ON SCROLL BAR... (2000 sr 1)

    You simply change the code you posted:

    If Cells(ScrollBar1.Value + 6, 4) = "C/C" Then
    'init list
    MsgBox "INIZIO ELENCO, IMPOSSIBILE PROSEGUIRE!", , "ATTENZIONE..."
    Exit Sub
    End If
    If Cells(ScrollBar1.Value + 6, 6) = "" Then
    'end list
    MsgBox "FINE ELENCO, IMPOSSIBILE PROSEGUIRE!", , "ATTENZIONE..."
    Exit Sub
    End If

    to:

    If Cells(Me.ScrollBar1.Value + 6, 4) = "C/C" Then
    'init list
    MsgBox "INIZIO ELENCO, IMPOSSIBILE PROSEGUIRE!", , "ATTENZIONE..."
    Exit Sub
    End If
    If Cells(Me.ScrollBar1.Value + 6, 6) = "" Then
    'end list
    MsgBox "FINE ELENCO, IMPOSSIBILE PROSEGUIRE!", , "ATTENZIONE..."
    Exit Sub
    End If
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

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

    Re: CONTROLL ON SCROLL BAR... (2000 sr 1)

    i am sorry , but it still dont work:-(

    Have you make a test to scroll up and down with the arrow?

    I dont recive nothing msbox to alert the end and the init list....

  8. #8
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: CONTROLL ON SCROLL BAR... (2000 sr 1)

    Could you attach a sample workbook ?
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

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

    Re: CONTROLL ON SCROLL BAR... (2000 sr 1)

    Tks you for interessing my problem!;-)

    my wbook is many big to attache from the forum utility/uplod, i insert up the link where i have located the wbook in the my personal site:

    http://www.gssitaly.com/l0785_def.zip

    http://www.gssitaly.com/l0785_def.zip

  10. #10
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: CONTROLL ON SCROLL BAR... (2000 sr 1)

    The problem is that you first assing a max value to the scrollbar:

    Private Sub UserForm_Initialize()

    ActiveSheet.Range("Q7").Select
    'Cells(me.ScrollBar1.Value + 6, 1)
    Indirizzario.ScrollBar1.Max = Range("Q65536").End(xlUp).Row - 6

    (Max set to 8)

    And then try to set the value property to something that is more than the max you just assigned:

    Sub PRIMO()
    Dim CL As Object
    Dim Y
    Dim x As String
    Dim I As Integer
    Dim TROVATO As Boolean
    Dim A As String
    Dim iRisposta As Integer 'Imposto la msgbox e relativa domanda

    x = Indirizzario.TextBox1.Value
    Set CL = Range("Q7:Q7500").Find(What:=x, lookat:=xlWhole)
    If CL Is Nothing Then
    MsgBox "ASSEGNO NON TROVATO!", , "ATTENZIONE..."
    Indirizzario.TextBox1 = ""
    Exit Sub
    Else

    Indirizzario.ScrollBar1.Value = CL.Row - 6

    Cl.Row-6 equals 9!
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

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

    Re: CONTROLL ON SCROLL BAR... (2000 sr 1)

    OK! but you have a time to modify my script, and post the related correction?
    Tks.

  12. #12
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: CONTROLL ON SCROLL BAR... (2000 sr 1)

    No I have no time to do that. I don't know what the logic is behind the script, so it would take me a lot of time to understand what it is doing.
    I have told you why it fails (and where), so I would expect you to be able to fix things.
    You just need to make sure the max property of the scrollbar is not exceeded elsewhere in your code.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

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

    Re: CONTROLL ON SCROLL BAR... (2000 sr 1)

    ... I i have solved many problem with your modify and note.
    But i dont solve one problem...

    In effect when i insert "5" in the txtbox38 automaticly the cursor go in the txtbox39 and i insert some word.
    The value of txtbox is inseted in the column X of the related sheet.
    but during the scroll with the bar the related value inserted in the column X is cleared (BOH!!!!!!)

    I have update my last project in this link:

    http://www.gssitaly.com/l0785_def.zip
    http://www.gssitaly.com/l0785_def.zip

  14. #14
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: CONTROLL ON SCROLL BAR... (2000 sr 1)

    Whenever tb38 changes it turns tb39 to a null string, and then puts the null string into Col x.

    You have to be aware that the txtbox38 change code will run whenever txtbox38 changes and if within the code tb39 is cleared, it will put the null into colX.


    Steve

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

    Re: CONTROLL ON SCROLL BAR... (2000 sr 1)

    have you an idea to correct this?

Page 1 of 2 12 LastLast

Posting Permissions

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