ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   two questions (https://www.excelbanter.com/excel-programming/355009-two-questions.html)

Jerome[_5_]

two questions
 
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


Tom Ogilvy

two questions
 
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.

--
Regards,
Tom Ogilvy

"Jerome" wrote in message
oups.com...
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




Carim[_3_]

two questions
 

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


Chris Marlow

two questions
 
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.

--
Chris Marlow
MCSD.NET, Microsoft Office XP Master


"Jerome" wrote:

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




All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com