LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Simple VBA Module functions do not work on the worksheet!

General/Standard module:
VBAProject\Modules\Module1


the one you get when you do Insert=Module

--
Regards,
Tom Ogilvy

"JCDW" wrote in message
...
Obviously I'm a neophyte. What is a 'standard' module? I've been
entering
these into VBAProject\MS Excel Objects\Sheet1 (Sheet1) and into
VBAProject\Modules\Module1.

Not worksheet code
use a standard module.

ShowSum will work as coded. CubeRoot:


Function CubeRoot(num As Double) As Double ' returns the cube root of a
number
CubeRoot = num ^ (1 / 3)
End Function


needs an argument
--
Gary's Student
gsnu200703


"JCDW" wrote:

In both Excel 2000 and 2007 when I enter the following functions on a
worksheet module (or the Excel obect page 'behind' the worksheet), I am
unable to execute (or call) on the worksheet. I get the error, [
#NAME? ].

Sub ShowSum()
Sum = 1 + 1
MsgBox "The answer is " & Sum
End Sub

Function CubeRoot() ' returns the cube root of a number
CubeRoot = num ^ (1 / 3)
End Function



 
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
How does a module of VB work in a Worksheet? VJ Sharma[_2_] Excel Worksheet Functions 1 April 30th 09 04:15 PM
CLASS MODULE & SIMPLE MODULE FARAZ QURESHI Excel Discussion (Misc queries) 1 September 7th 07 09:32 AM
Calling worksheet functions from within a module Daz Excel Programming 1 November 29th 06 03:05 AM
Calling worksheet module from other module. Michael Malinsky Excel Programming 2 December 14th 05 08:47 PM
Run worksheet module code from workbook module? keithb Excel Programming 1 August 14th 05 04:04 AM


All times are GMT +1. The time now is 10:14 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"