Excel macro button to change change cell values

后端 未结 2 1773
情深已故
情深已故 2021-01-17 02:41

Any ideas on how to get a button to change cell values based on a table. Say cell A1 is the active cell and i want this value changed everytime I click the button based on t

2条回答
  •  一向
    一向 (楼主)
    2021-01-17 02:59

    If you interested to use a helper cell then you can use following codes.

        Private Sub CommandButton1_Click()
        Dim increment As Long
            increment = Range("XFD1048576").Value
              Range("A1").Value = Range("B1").Offset(increment, 0).Value
            Range("XFD1048576").Value = increment + 1
    
            If Range("XFD1048576").Value >= Range("B:B").End(xlDown).Row Then
                Range("XFD1048576").Value = 0
            End If
        End Sub
    

提交回复
热议问题