PDA

View Full Version : Solved: optionbutton to set commandbutton focus



Nurofen
10-20-2007, 01:27 PM
HI,

I have created a tally sheet with commandbuttons which when press increase by one in the first column.

How can i use the option button to set the focus to another column
and have the commandbuttons update that column?



Thank you for your time

Nurofen

Bob Phillips
10-20-2007, 02:09 PM
Option Explicit

Private ColNum As Long

Private Sub CommandButton1_Click()
With Me.Cells(9, ColNum)
.Value = .Value + 1
End With
End Sub
Private Sub CommandButton2_Click()
With Me.Cells(11, ColNum)
.Value = .Value + 1
End With
End Sub
Private Sub CommandButton3_Click()
With Me.Cells(14, ColNum)
.Value = .Value + 1
End With
End Sub
Private Sub CommandButton4_Click()
With Me.Cells(17, ColNum)
.Value = .Value + 1
End With
End Sub

Private Sub OptionButton1_Click()
ColNum = 4
End Sub
Private Sub OptionButton2_Click()
ColNum = 6
End Sub
Private Sub OptionButton3_Click()
ColNum = 8
End Sub
Private Sub OptionButton4_Click()
ColNum = 10
End Sub

Nurofen
10-20-2007, 02:19 PM
Hi Xld

Thank you for your time





Nurofen