Forum Discussion

Dromerolovo95's avatar
Dromerolovo95
Copper Contributor
Nov 27, 2019
Solved

Difference between regular input and spin button?

So what's the difference between changing the value of a cell with a spin button and with a regular input( Changing the number with the keyboard, and enter).  I'm asking this because I've done a VBA code to do a "two-way linking" between two cells. And it works fine, but...

 

The VBA code is the following:

'In Sheet 1:

Private Sub Worksheet_Change(ByVal Target As Range)

     If Not Intersect(Target,Range("B10")) Is Nothing Then 

          If Target = Range("B10") Then     

              Sheets("Sheet2").Range("D11").Value = Target.Value

          End If

     End If 

 

'In Sheet 2

Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Intersect(Target, Range("D11")) Is Nothing Then

         If Target = Range("D11") Then

              If Sheets("Sheet1").Range("B10").Value <> Target.Value Then

                    Sheets("Sheet1").Range("B10").Value = Target.Value

              End If

          End If

     End If

 

BUT, when I use the spin button to change the value of one of the cells, nothing happens

 

Can anybody explain to me why this happens and how to make a better solution

 

Thanks!

 

 

 

 

 

 

 

 

  • Dromerolovo95 Unfortunately, the Spin button control doesn't trigger the Change event. It does, however, trigger the Calculate event, so you might be able to use that.

1 Reply

  • Dromerolovo95 Unfortunately, the Spin button control doesn't trigger the Change event. It does, however, trigger the Calculate event, so you might be able to use that.

Resources