Consulting

Results 1 to 7 of 7

Thread: Solved: Chart. Very different value. SpinButton

  1. #1

    Solved: Chart. Very different value. SpinButton

    Hi.
    My code dont work excactly what I need!
    How this problem solve?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Tad light on detail. What is it supposed to do?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Every time if I click SpinButtonUp the Values in the cells (in Columns B) B2...B must change 10 times larger.
    And if I click SpinButtonDown values must change 10 times smaller.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Option Explicit

    Sub AAA()
    Dim LastRow As Long
    Dim z As Range

    LastRow = Range("A2").End(xlDown).Row

    For Each z In Range("B2:B" & LastRow)

    If z.Value = "" Then Exit For
    z.Value = z.Value * 10
    Next z
    End Sub

    Sub BBB()
    Dim LastRow As Long
    Dim z As Range

    LastRow = Range("A2").End(xlDown).Row

    If Range("H1").Value > 0 Then

    For Each z In Range("B2:B" & LastRow)

    If z.Value = "" Then Exit For
    z.Value = z.Value / 10
    Next z
    End If
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    Thanks XLD.

    This good, but my problem is SpinButton wrong work.
    If I begin run macrocode the Range B2.Value =3 & SpinButton LinkedCell i.e. RangeH1.Value=0 Ok
    When I Click SB Up 1 time Range B2.Value=30 & SB Linked Cell i.e RangeH1.Value=1. OK
    Now when I click SB Down LinkedCell Range H1.Value=0 i.e OK, but Range B2.Value30 That is problem???
    This must be 3.

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Option Explicit

    Private fZero As Boolean

    Sub AAA()
    Dim LastRow As Long
    Dim z As Range

    LastRow = Range("A2").End(xlDown).Row
    For Each z In Range("B2:B" & LastRow)

    If z.Value = "" Then Exit For
    z.Value = z.Value * 10
    Next z

    fZero = False
    End Sub

    Sub BBB()
    Dim LastRow As Long
    Dim z As Range

    If fZero Then Exit Sub

    If Range("H1").Value = 0 Then

    fZero = True
    End If

    LastRow = Range("A2").End(xlDown).Row
    For Each z In Range("B2:B" & LastRow)

    If z.Value = "" Then Exit For
    z.Value = z.Value / 10
    Next z
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    THANKS xld.
    Works good.

Posting Permissions

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