Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Creating a function

Below is a function I am working with to calculate
commissions. How do I get it to where when I click on a
cell in Excel, and then go to insert function, how do I
make it to where I can select that function from in
there? Right now I dont see it in there.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default Creating a function

You should be able to see it in the function category Userd Defined
If not, post again

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel


"Todd Huttenstine" wrote in message
...
Below is a function I am working with to calculate
commissions. How do I get it to where when I click on a
cell in Excel, and then go to insert function, how do I
make it to where I can select that function from in
there? Right now I dont see it in there.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Creating a function

Todd,

Where have you stored it? It should be in a general module, not a worksheet
module or ThisWorkbook.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine" wrote in message
...
Below is a function I am working with to calculate
commissions. How do I get it to where when I click on a
cell in Excel, and then go to insert function, how do I
make it to where I can select that function from in
there? Right now I dont see it in there.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Creating a function

Ah there we go, thank you. I had it in the worksheet
module. I put it in a regular module and now its in User
Defined, however when I try to insert it in cell A1, it
does nothing. when I am inserting it in cell A1 it says
this function takes no arguments. So how would I make it
take argument so that whatever is in cell A1, it will use
that value as the variable instead of the input box?


-----Original Message-----
Todd,

Where have you stored it? It should be in a general

module, not a worksheet
module or ThisWorkbook.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine"

wrote in message
...
Below is a function I am working with to calculate
commissions. How do I get it to where when I click on a
cell in Excel, and then go to insert function, how do I
make it to where I can select that function from in
there? Right now I dont see it in there.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Creating a function



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine" wrote in message
...
Ah there we go, thank you. I had it in the worksheet
module. I put it in a regular module and now its in User
Defined, however when I try to insert it in cell A1, it
does nothing. when I am inserting it in cell A1 it says
this function takes no arguments. So how would I make it
take argument so that whatever is in cell A1, it will use
that value as the variable instead of the input box?


-----Original Message-----
Todd,

Where have you stored it? It should be in a general

module, not a worksheet
module or ThisWorkbook.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine"

wrote in message
...
Below is a function I am working with to calculate
commissions. How do I get it to where when I click on a
cell in Excel, and then go to insert function, how do I
make it to where I can select that function from in
there? Right now I dont see it in there.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Creating a function

Todd,

If you want to put the function in A1, it cannot use a value in A1, that's
a circular reference. A function in a cell can only reference another cell.
SO if you want to pick up SalesQ from a cell, the function would look like
this

Public Function CalComm(SalesQ) As Currency
CalComm = SalesQ * (1.5 / 100)
End Function

and if A1 held the SalesQ figure, the function would go in A2 or some other
cell and would look like

=CalComm(A1)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine" wrote in message
...
Ah there we go, thank you. I had it in the worksheet
module. I put it in a regular module and now its in User
Defined, however when I try to insert it in cell A1, it
does nothing. when I am inserting it in cell A1 it says
this function takes no arguments. So how would I make it
take argument so that whatever is in cell A1, it will use
that value as the variable instead of the input box?


-----Original Message-----
Todd,

Where have you stored it? It should be in a general

module, not a worksheet
module or ThisWorkbook.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine"

wrote in message
...
Below is a function I am working with to calculate
commissions. How do I get it to where when I click on a
cell in Excel, and then go to insert function, how do I
make it to where I can select that function from in
there? Right now I dont see it in there.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Creating a function

When I do that Im getting #VALUE error


-----Original Message-----
Todd,

If you want to put the function in A1, it cannot use a

value in A1, that's
a circular reference. A function in a cell can only

reference another cell.
SO if you want to pick up SalesQ from a cell, the

function would look like
this

Public Function CalComm(SalesQ) As Currency
CalComm = SalesQ * (1.5 / 100)
End Function

and if A1 held the SalesQ figure, the function would go

in A2 or some other
cell and would look like

=CalComm(A1)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine"

wrote in message
...
Ah there we go, thank you. I had it in the worksheet
module. I put it in a regular module and now its in

User
Defined, however when I try to insert it in cell A1, it
does nothing. when I am inserting it in cell A1 it says
this function takes no arguments. So how would I make

it
take argument so that whatever is in cell A1, it will

use
that value as the variable instead of the input box?


-----Original Message-----
Todd,

Where have you stored it? It should be in a general

module, not a worksheet
module or ThisWorkbook.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Todd Huttenstine"


wrote in message
...
Below is a function I am working with to calculate
commissions. How do I get it to where when I click

on a
cell in Excel, and then go to insert function, how

do I
make it to where I can select that function from in
there? Right now I dont see it in there.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



.



.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Creating a function

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Function main(SalesQ as Double) as string
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



The above is your sub re-written (quickly) as a function. If it doesn't
work post back.

--
Michael Hopwood


"Todd Huttenstine" wrote in message
...
When I do that Im getting #VALUE error


-----Original Message-----
Todd,

If you want to put the function in A1, it cannot use a

value in A1, that's
a circular reference. A function in a cell can only

reference another cell.
SO if you want to pick up SalesQ from a cell, the

function would look like
this

Public Function CalComm(SalesQ) As Currency
CalComm = SalesQ * (1.5 / 100)
End Function

and if A1 held the SalesQ figure, the function would go

in A2 or some other
cell and would look like

=CalComm(A1)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine"

wrote in message
...
Ah there we go, thank you. I had it in the worksheet
module. I put it in a regular module and now its in

User
Defined, however when I try to insert it in cell A1, it
does nothing. when I am inserting it in cell A1 it says
this function takes no arguments. So how would I make

it
take argument so that whatever is in cell A1, it will

use
that value as the variable instead of the input box?


-----Original Message-----
Todd,

Where have you stored it? It should be in a general
module, not a worksheet
module or ThisWorkbook.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Todd Huttenstine"


wrote in message
...
Below is a function I am working with to calculate
commissions. How do I get it to where when I click

on a
cell in Excel, and then go to insert function, how

do I
make it to where I can select that function from in
there? Right now I dont see it in there.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



.



.



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Creating a function

Todd,

That probably means that you don't have a number in A1.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine" wrote in message
...
When I do that Im getting #VALUE error


-----Original Message-----
Todd,

If you want to put the function in A1, it cannot use a

value in A1, that's
a circular reference. A function in a cell can only

reference another cell.
SO if you want to pick up SalesQ from a cell, the

function would look like
this

Public Function CalComm(SalesQ) As Currency
CalComm = SalesQ * (1.5 / 100)
End Function

and if A1 held the SalesQ figure, the function would go

in A2 or some other
cell and would look like

=CalComm(A1)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine"

wrote in message
...
Ah there we go, thank you. I had it in the worksheet
module. I put it in a regular module and now its in

User
Defined, however when I try to insert it in cell A1, it
does nothing. when I am inserting it in cell A1 it says
this function takes no arguments. So how would I make

it
take argument so that whatever is in cell A1, it will

use
that value as the variable instead of the input box?


-----Original Message-----
Todd,

Where have you stored it? It should be in a general
module, not a worksheet
module or ThisWorkbook.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Todd Huttenstine"


wrote in message
...
Below is a function I am working with to calculate
commissions. How do I get it to where when I click

on a
cell in Excel, and then go to insert function, how

do I
make it to where I can select that function from in
there? Right now I dont see it in there.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



.



.



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Creating a function

I do have a number in there. Its 550.
-----Original Message-----
Todd,

That probably means that you don't have a number in A1.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine"

wrote in message
...
When I do that Im getting #VALUE error


-----Original Message-----
Todd,

If you want to put the function in A1, it cannot use a

value in A1, that's
a circular reference. A function in a cell can only

reference another cell.
SO if you want to pick up SalesQ from a cell, the

function would look like
this

Public Function CalComm(SalesQ) As Currency
CalComm = SalesQ * (1.5 / 100)
End Function

and if A1 held the SalesQ figure, the function would

go
in A2 or some other
cell and would look like

=CalComm(A1)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Todd Huttenstine"


wrote in message
...
Ah there we go, thank you. I had it in the worksheet
module. I put it in a regular module and now its in

User
Defined, however when I try to insert it in cell A1,

it
does nothing. when I am inserting it in cell A1 it

says
this function takes no arguments. So how would I

make
it
take argument so that whatever is in cell A1, it will

use
that value as the variable instead of the input box?


-----Original Message-----
Todd,

Where have you stored it? It should be in a general
module, not a worksheet
module or ThisWorkbook.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Todd Huttenstine"


wrote in message
...
Below is a function I am working with to calculate
commissions. How do I get it to where when I

click
on a
cell in Excel, and then go to insert function, how

do I
make it to where I can select that function from

in
there? Right now I dont see it in there.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



.



.



.



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Creating a function

Todd,

Then I am confused, because when I use 550, A2 returns 8.25.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine" wrote in message
...
I do have a number in there. Its 550.
-----Original Message-----
Todd,

That probably means that you don't have a number in A1.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine"

wrote in message
...
When I do that Im getting #VALUE error


-----Original Message-----
Todd,

If you want to put the function in A1, it cannot use a
value in A1, that's
a circular reference. A function in a cell can only
reference another cell.
SO if you want to pick up SalesQ from a cell, the
function would look like
this

Public Function CalComm(SalesQ) As Currency
CalComm = SalesQ * (1.5 / 100)
End Function

and if A1 held the SalesQ figure, the function would

go
in A2 or some other
cell and would look like

=CalComm(A1)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Todd Huttenstine"


wrote in message
...
Ah there we go, thank you. I had it in the worksheet
module. I put it in a regular module and now its in
User
Defined, however when I try to insert it in cell A1,

it
does nothing. when I am inserting it in cell A1 it

says
this function takes no arguments. So how would I

make
it
take argument so that whatever is in cell A1, it will
use
that value as the variable instead of the input box?


-----Original Message-----
Todd,

Where have you stored it? It should be in a general
module, not a worksheet
module or ThisWorkbook.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the
Purbecks
(remove nothere from the email address if mailing
direct)

"Todd Huttenstine"

wrote in message
...
Below is a function I am working with to calculate
commissions. How do I get it to where when I

click
on a
cell in Excel, and then go to insert function, how
do I
make it to where I can select that function from

in
there? Right now I dont see it in there.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



.



.



.



  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Creating a function

No still didnt. I took the msgbox out since I dont want
that to display if I am going to use it in a cell. it
shows "" in the cell.



-----Original Message-----
Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Function main(SalesQ as Double) as string
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



The above is your sub re-written (quickly) as a

function. If it doesn't
work post back.

--
Michael Hopwood


"Todd Huttenstine"

wrote in message
...
When I do that Im getting #VALUE error


-----Original Message-----
Todd,

If you want to put the function in A1, it cannot use a

value in A1, that's
a circular reference. A function in a cell can only

reference another cell.
SO if you want to pick up SalesQ from a cell, the

function would look like
this

Public Function CalComm(SalesQ) As Currency
CalComm = SalesQ * (1.5 / 100)
End Function

and if A1 held the SalesQ figure, the function would

go
in A2 or some other
cell and would look like

=CalComm(A1)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Todd Huttenstine"


wrote in message
...
Ah there we go, thank you. I had it in the worksheet
module. I put it in a regular module and now its in

User
Defined, however when I try to insert it in cell A1,

it
does nothing. when I am inserting it in cell A1 it

says
this function takes no arguments. So how would I

make
it
take argument so that whatever is in cell A1, it will

use
that value as the variable instead of the input box?


-----Original Message-----
Todd,

Where have you stored it? It should be in a general
module, not a worksheet
module or ThisWorkbook.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Todd Huttenstine"


wrote in message
...
Below is a function I am working with to calculate
commissions. How do I get it to where when I

click
on a
cell in Excel, and then go to insert function, how

do I
make it to where I can select that function from

in
there? Right now I dont see it in there.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



.



.



.

  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Creating a function

Se what I want is to where I can insert that function in
cell A2 and reference cell A1 where the number is. Then
when I click the OK button after I select cell A1 (or
whatever cell I want to reference), I want the answer to
be put in the cell where I inserted the function(in this
case it would be cell A2.).

using the below code..., when I run sub main, it uses an
input box and gives me the correct answer, but instead of
using an input box, I would rather just make it like any
other function where I reference cells.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency

Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



Thanx

Todd Huttenstine
  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Creating a function

hey Bob,

I got it to work. Below is what I was doing which was
causing the error...
Public Function CalComm() As Currency
CalComm = SalesQ * (1.5 / 100)
End Function

I failed to put SalesQ in the parenthesis.

Thank you and to everyone else who helped me. I seem to
be finding myself spending allot of time on obvious
mistakes.

Thanx again

Todd


-----Original Message-----


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine"

wrote in message
...
Ah there we go, thank you. I had it in the worksheet
module. I put it in a regular module and now its in

User
Defined, however when I try to insert it in cell A1, it
does nothing. when I am inserting it in cell A1 it says
this function takes no arguments. So how would I make

it
take argument so that whatever is in cell A1, it will

use
that value as the variable instead of the input box?


-----Original Message-----
Todd,

Where have you stored it? It should be in a general

module, not a worksheet
module or ThisWorkbook.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Todd Huttenstine"


wrote in message
...
Below is a function I am working with to calculate
commissions. How do I get it to where when I click

on a
cell in Excel, and then go to insert function, how

do I
make it to where I can select that function from in
there? Right now I dont see it in there.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



.



.

  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Creating a function

Just a note, and a guess. Make sure the variable of the answer is the same
name as your function. It appears that you keep changing them.

In your function, "CalComm" and "CalculateCommission" are different names.

Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function



For example,

Public Function CalComm(SalesQ) As Currency
CalComm = SalesQ * 0.015 '(1.5%)
End Function


Just thought I'd mention it in case you didn't catch it from the other
posts.
--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Todd Huttenstine" wrote in message
...
Se what I want is to where I can insert that function in
cell A2 and reference cell A1 where the number is. Then
when I click the OK button after I select cell A1 (or
whatever cell I want to reference), I want the answer to
be put in the cell where I inserted the function(in this
case it would be cell A2.).

using the below code..., when I run sub main, it uses an
input box and gives me the correct answer, but instead of
using an input box, I would rather just make it like any
other function where I reference cells.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency

Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub

Thanx

Todd Huttenstine





  #16   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Creating a function

Well we would never have guessed that unless you posted the code, so well
done for sorting it yourself. It is still the best way to learn<g

B ob

"Todd Huttenstine" wrote in message
...
hey Bob,

I got it to work. Below is what I was doing which was
causing the error...
Public Function CalComm() As Currency
CalComm = SalesQ * (1.5 / 100)
End Function

I failed to put SalesQ in the parenthesis.

Thank you and to everyone else who helped me. I seem to
be finding myself spending allot of time on obvious
mistakes.

Thanx again

Todd


-----Original Message-----


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine"

wrote in message
...
Ah there we go, thank you. I had it in the worksheet
module. I put it in a regular module and now its in

User
Defined, however when I try to insert it in cell A1, it
does nothing. when I am inserting it in cell A1 it says
this function takes no arguments. So how would I make

it
take argument so that whatever is in cell A1, it will

use
that value as the variable instead of the input box?


-----Original Message-----
Todd,

Where have you stored it? It should be in a general
module, not a worksheet
module or ThisWorkbook.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Todd Huttenstine"


wrote in message
...
Below is a function I am working with to calculate
commissions. How do I get it to where when I click

on a
cell in Excel, and then go to insert function, how

do I
make it to where I can select that function from in
there? Right now I dont see it in there.

Option Explicit
Dim SalesQ As Currency
Dim CalculateCommission As Currency
Public Function CalComm() As Currency
CalculateCommission = SalesQ * (1.5 / 100)
End Function

Public Sub main()
SalesQ = InputBox("Enter Sales Amount")
Call CalComm
MsgBox ("The commission amount is: $" &
CalculateCommission)
End Sub



.



.



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
Help with creating a function Craig Excel Worksheet Functions 4 February 2nd 09 09:51 PM
Creating a Function Stu Gnu[_2_] Excel Worksheet Functions 2 August 30th 07 11:47 AM
Creating a function BeginnerRick Excel Worksheet Functions 3 November 24th 06 09:12 PM
Need help creating a function nander Excel Discussion (Misc queries) 3 February 20th 06 04:57 AM
creating a function NeilPoehlmann Excel Discussion (Misc queries) 5 June 15th 05 08:08 PM


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

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

About Us

"It's about Microsoft Excel"