Thread: Option Buttons
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Option Buttons

Use the following in your procedures to add new records.

If range("A1").value = "" then
Range("A1").value = 15
else
range("A1").end(xldown).offset(1,0).value = 15
end if

Add another button that clears the selections with code like...
if range("A1").value = "" then
exit sub
else
range(range("A1"),range("A1").end(xldown)).clearco ntents
End if
--
JNW


"Saxman" wrote:

I have created the VBA code below and option buttons in a group, so that when a
button is clicked the value is recorded in cell A.

However, I would like to record the next event in cell A2 and possibly so on up to
A25. Is this possible, and am I able to clear the events afterwards, so that I
begin recording in cell A1 again? I don't want to end up with 25 sets of option
buttons on my worksheet!

Sub SelectC()
Range("A1").Value = "=15"
End Sub
Sub SelectD()
Range("A1").Value = "=15"
End Sub
Sub SelectCD()
Range("A1").Value = "=10"
End Sub

Thanks.
--