PDA

View Full Version : Solved: Chart. Very different value. SpinButton



omnibuster
01-10-2009, 12:18 PM
Hi.
My code dont work excactly what I need!
How this problem solve?
:banghead:

Bob Phillips
01-10-2009, 02:39 PM
Tad light on detail. What is it supposed to do?

omnibuster
01-10-2009, 03:04 PM
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.

Bob Phillips
01-10-2009, 03:46 PM
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

omnibuster
01-10-2009, 04:13 PM
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.

Bob Phillips
01-10-2009, 04:55 PM
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

omnibuster
01-11-2009, 05:07 AM
THANKS xld.
Works good.