SpinButton Change Selection
Hi Toppers,
the event "GotFocus" makes nearly what I want:
Private Sub SpinButton1_GotFocus()
With SpinButton1
.Min = 1
.Max = 10
Cells(.Value, 1).Select
End With
End Sub
But if I press the Down-Button the Cursors goes upwards
and if I press the Up-Button the Cursor goes down.
Strange. - Any idea why?
Best regards,
Marlon
-----Original Message-----
Hi Toppers,
that doesn't help me either.
Meanwhile I tried something this:
Private Sub SpinButton1_SpinDown()
ActiveCell.Offset(1, 0).Activate
End Sub
Private Sub SpinButton1_SpinUp()
ActiveCell.Offset(-1, 0).Activate
End Sub
But it has the same effect as the first code. When I
press one of the buttons of the Spinbutton the Cursor
changes to the next cell (that's OK). But if I press the
button again the Cursor/Selection disappears. If I press
the button again the Cursor reappears in the next cell
and so on.
Best regards,
Marlon
-----Original Message-----
Marlon,
The following works .. with B1 as Cell
Link.
Sub Spinner1_change()
Cells(Range("b1"), 1).Select
Cells(Range("b1"), 1) = Range("b1")
End Sub
"Marlon" wrote:
Hi,
I would like to create a SpinButton with which I
change
from one cell to the next one (up and down).
I tried this:
Private Sub SpinButton1_Change()
With SpinButton1
.Min = 1
.Max = 10
Cells(.Value, 1).Select
Cells(.Value, 1) = .Value
End With
End Sub
The problem is that the "Cells(.Value, 1).Select"
doesn't
work properly. But the values in the cells are like
expected "Cells(.Value, 1) = .Value". If you use the
code
above you can see what I mean.
Many thanks for help.
Best regards,
Marlon
.
.
|