Create Button in Excel when click will set the value of specified cell to true

I need to create a button in excel and when it is click it will set the value of a specified cell to "True".

I know how to add a button.  I just need to know what code I need to put in?

Private Sub CommandButton1_Click()
what do I add?
End Sub

Thanks!
mschiradAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saqib Husain, SyedEngineerCommented:
Range("A1").value = true

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Juan OcasioApplication DeveloperCommented:
Sheets("SheetName").Cells(1, 1).Value = "True"

1,1 = A,1 so if your cell is c,3 it would be 3,3
mschiradAuthor Commented:
Thanks!
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

mschiradAuthor Commented:
I just thought of something else.  Could I add something so that when you click it again it would go back to false?
Juan OcasioApplication DeveloperCommented:
Private Sub CommandButton1_Click()
If Sheets("Sheet1").Cells(1, 1).Value = "True" Then
     Sheets("Sheet1").Cells(1, 1).Value = "False"
Else
     Sheets("Sheet1").Cells(1, 1).Value = "True"
End If
End Sub
Saqib Husain, SyedEngineerCommented:
=Range("A1").value = not Range("A1").value
mschiradAuthor Commented:
thanks so much!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.