two questions

  • Thread starter Thread starter Jerome
  • Start date Start date
J

Jerome

hey everyone

I was just wondering if you could please answer 2 simple questions I
have...

1) What is the code to put text into a cell? eg, what code would I add
to a comand button to make cell A1 say "hello"?

2) And, If i have a userform with two option buttons, then when I start
the program, the first option button is automatically selected. Is
there a code so that both buttons remain "unselected"?

Thanks so much, Jerome
 
Private Sub CommandButton1_Click()
With Worksheets("Sheet1")
.Range("A1").Value = "Hello"
' or
'.Range("A1").Value = Userform1.Textbox1.Text
End With
End Sub

In the VBE select the option button and look at its properties. Set the
value property to false.

Do this to both option buttons.
 
Salut Jerome,

1. The code to input text would be :

Range("A1").Value = "Hello"

2. If option buttons are grouped, they become mutually exclusive ...

HTH
Bonne Chance
 
Jerome,

1)

Range("A1")="hello" would do it.
Cells(1,1)="hello" would be a little more swish

2)

Check the 'Value' of the option button that is checked in the Properties
window in VBA - change it to False.

Regards,

Chris.
 
Back
Top