VB code for Excel sheet
Not sure exactly what you are trying to do - your code at present just puts a
car name in cells F1, F2, or F3 (column F is 5 columns offset from column A)
if a particular check box has been clicked.
if you need to get the next empty cell then you need to use the 'end' method
of the range object - this is like using ctrl + left, right, up , down arrows
on the keyboard.
For example, if the activecell is in a1, at the top of a column of entries,
and you want to find the next empty cell beow this column then:
activecell.end(xldown)
will take you to the last entry in the column, so
activecell.end(xldown) .offset(1,0) will take you to the next (empty) cell
down
"Kerry" wrote:
I am trying to write a code for a form with check boxes in excel 2003. When a
person chooses a number of checkboxes it will put the information into a cell
and then go to the next blank cell and add the next checkbox data. This is
the code I have so far but instead of choosing the next blank cell it chooses
a set cell. How can I change this to choose the next blank cell?
Private Sub cmdOK_Click()
ActiveWorkbook.Sheets("Cars").Activate
Range("A1").Select
If chkFord = True Then
ActiveCell.Offset(0, 5).Value = "Ford"
End If
If chkToyota = True Then
ActiveCell.Offset(1, 5).Value = "Toyota"
End If
If chkMazda = True Then
ActiveCell.Offset(2, 5).Value = "Mazda"
End If
End Sub
Thanks Kerry
|