clear a cell with command button?


Posted by Keith on August 23, 2001 8:25 AM

Hello all,

This is my first try at using the controls. I'm trying to have the command button clear the contents of cell c4 when pressed. Here's what I've tried:

Private Sub CommandButton1_Click()
c4.Text = ""
End Sub

but I'm just shooting in the dark as I have no reference other than an old VB book. Can anyone help? Thanks in advance.

~Keith

Posted by Steve Mathews on August 23, 2001 8:30 AM

Try this:
Private Sub CommandButton1_Click()
Range("c4").Value = ""
End Sub

Posted by Keith on August 23, 2001 9:07 AM

Thank you, Steve, works great!

Is there a list anywhere of the syntax that's needed to navigate cells and books in VB?

Thanks again for your help!

~Keith

Posted by Steve Mathews on August 23, 2001 9:28 AM

Re: Thank you, Steve, works great!

I'm not sure exactly what you are looking for but the best resource for finding information is the microsoft msdn library:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/modcore/html/deovrMicrosoftExcel2000.asp


If you have a specific example of what you are trying to accomplish I will try and help.
Steve



Posted by Keith on August 23, 2001 11:26 AM

Holy Smokes! :-)

Wow! The article tree on Adding Active X Controls to Exel is INCREDIBLE! That's exactly what I've been looking for. Thank you!