View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Luke M Luke M is offline
external usenet poster
 
Posts: 2,722
Default New to Visual Basic

First, remove the private from your macro, since you want to call it out via
a button (I assume).

Also, "Cells.Value("A1") = sName" is not valid. Change it to:
Cells(1,1).Value = sName

Using the Forms toolbar (NOT control), create a button. Then assign your
macro to the button.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Need help with sumif" wrote:

I wrote this simple task can anyone tell me how do I run this

Private Sub CommandButton1_Click()
Dim sName As String
sName = InputBox("Enter your name", "Title")
Cells.Value("A1") = sName
End Sub