Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Newbie Error

Hello

I have created a Button on a worksheet called Button1

To test it before going any further, since I am so new, I have entered this
code in the worksheet

Private Sub Button1_Click()

MsgBox "you clicked here"

End Sub

An error message keeps coming up saying:
"The macro 'Project.xls!Button1_Click' cannot be found.

What am I missing?

David
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Don is offline
external usenet poster
 
Posts: 487
Default Newbie Error

David,

Not sure about this but are you sure the button is named "Button1" and not
"CommandButton1"?

"David" wrote:

Hello

I have created a Button on a worksheet called Button1

To test it before going any further, since I am so new, I have entered this
code in the worksheet

Private Sub Button1_Click()

MsgBox "you clicked here"

End Sub

An error message keeps coming up saying:
"The macro 'Project.xls!Button1_Click' cannot be found.

What am I missing?

David

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Newbie Error

Put it in a standard code module, not in the worksheet code module.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"David" wrote in message
...
Hello

I have created a Button on a worksheet called Button1

To test it before going any further, since I am so new, I have entered
this
code in the worksheet

Private Sub Button1_Click()

MsgBox "you clicked here"

End Sub

An error message keeps coming up saying:
"The macro 'Project.xls!Button1_Click' cannot be found.

What am I missing?

David



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Newbie Error

Thanks Bob

Why is it that I need to do that?
I am used to working with Access where I put all the code into the form.

"Bob Phillips" wrote:

Put it in a standard code module, not in the worksheet code module.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"David" wrote in message
...
Hello

I have created a Button on a worksheet called Button1

To test it before going any further, since I am so new, I have entered
this
code in the worksheet

Private Sub Button1_Click()

MsgBox "you clicked here"

End Sub

An error message keeps coming up saying:
"The macro 'Project.xls!Button1_Click' cannot be found.

What am I missing?

David




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Newbie Error

Because the button that you are using is not a sheet object, so it doesn't
belong in the sheet's code module. If you had used a button from the control
toolbox, it would have been a sheet event procedure.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"David" wrote in message
...
Thanks Bob

Why is it that I need to do that?
I am used to working with Access where I put all the code into the form.

"Bob Phillips" wrote:

Put it in a standard code module, not in the worksheet code module.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"David" wrote in message
...
Hello

I have created a Button on a worksheet called Button1

To test it before going any further, since I am so new, I have entered
this
code in the worksheet

Private Sub Button1_Click()

MsgBox "you clicked here"

End Sub

An error message keeps coming up saying:
"The macro 'Project.xls!Button1_Click' cannot be found.

What am I missing?

David








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Newbie Error

Thanks Bob

"Bob Phillips" wrote:

Because the button that you are using is not a sheet object, so it doesn't
belong in the sheet's code module. If you had used a button from the control
toolbox, it would have been a sheet event procedure.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"David" wrote in message
...
Thanks Bob

Why is it that I need to do that?
I am used to working with Access where I put all the code into the form.

"Bob Phillips" wrote:

Put it in a standard code module, not in the worksheet code module.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"David" wrote in message
...
Hello

I have created a Button on a worksheet called Button1

To test it before going any further, since I am so new, I have entered
this
code in the worksheet

Private Sub Button1_Click()

MsgBox "you clicked here"

End Sub

An error message keeps coming up saying:
"The macro 'Project.xls!Button1_Click' cannot be found.

What am I missing?

David






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie Run Time Error have_a_cup Excel Programming 2 June 15th 06 11:56 PM
Compile error: Ambigious name detected: Worksheet_Change **NEWBIE** Dan Excel Programming 3 May 26th 06 05:57 PM
Newbie Q: Error handling procedures in a loop KR Excel Programming 2 March 4th 05 05:51 PM
Newbie: Error 1004 Barry Aylett-Warner Excel Programming 6 August 26th 04 05:14 PM
error in my VBA (newbie) Stephanie S Excel Programming 3 September 17th 03 08:25 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"