Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Using VBA functions in MS Excel

Hi,

I've just strarted using vba function to automate some of my spreadsheets.
I've created a function in a worksheet, but no matter what I try I can't seem
to access the function from a cell - any help would be greatfully accepted
--
Just getting used to VBA!!!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Using VBA functions in MS Excel

welcome to VBA!
you need to post your function's code in order for somebody to help
you.
:)
susan


On Nov 3, 1:36*pm, Diarmuid
wrote:
Hi,

I've just strarted using vba function to automate some of my spreadsheets.. *
I've created a function in a worksheet, but no matter what I try I can't seem
to access the function from a cell - any help would be greatfully accepted
--
Just getting used to VBA!!!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default Using VBA functions in MS Excel

<I've created a function in a worksheet

If you mean in a Worksheet Module, then that's the problem.
The function should be in a standard module (from InsertModule)

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Diarmuid" wrote in message
...
Hi,

I've just strarted using vba function to automate some of my spreadsheets.
I've created a function in a worksheet, but no matter what I try I can't
seem
to access the function from a cell - any help would be greatfully accepted
--
Just getting used to VBA!!!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Using VBA functions in MS Excel

Hi,

Thanks for the reply :)


I'll be using lots of functions and I've checked the functions themselves to
make sure they work - the problem comes when I try to use them in a
worksheet. When I enter them into a cell in the same way as I would use any
other worksheet function I just get a #NAME? error displayed in the cell.
I've checked the spellings of the functions and have even tried setting the
security to low (as well as having the functions signed) and it doesn't seem
to make any difference.

Alot of what I'm doing is extracting information from CSV files that have
been created using older systems. The following is just a simple function
that I use to get a number out of a string - its probably messy code but it
should work!

Public Function ExtractNumber(strValue As String) As Single
' Read in a string of text and extract a number contained within it
Dim bytPointer1, bytPointer2 As Byte
Dim strReturn As String
Dim sngReturn As Single
Dim bytCntr As Byte
bytCntr = 49

Do
bytPointer1 = InStr(1, strValue, Chr(bytCntr))
bytCntr = bytCntr + 1

Loop Until bytPointer1 0

bytPointer2 = InStr(bytPointer1, strValue, " ")

If bytPointer2 0 Then
bytPointer2 = bytPointer2 - bytPointer1
strReturn = LTrim$(RTrim$(Mid$(strValue, bytPointer1, bytPointer2)))
Else
strReturn = LTrim$(RTrim$(Mid$(strValue, bytPointer1)))
End If

sngReturn = Val(strReturn)

ExtractNumber = sngReturn
End Function
--
Just getting used to VBA!!!



"Susan" wrote:

welcome to VBA!
you need to post your function's code in order for somebody to help
you.
:)
susan


On Nov 3, 1:36 pm, Diarmuid
wrote:
Hi,

I've just strarted using vba function to automate some of my spreadsheets..
I've created a function in a worksheet, but no matter what I try I can't seem
to access the function from a cell - any help would be greatfully accepted
--
Just getting used to VBA!!!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Using VBA functions in MS Excel

Thanks very much for the help!

Boy do I feel sheepish :{


Its amazing how simple the solution is when somebody points it out to you!
--
Just getting used to VBA!!!



"Niek Otten" wrote:

<I've created a function in a worksheet

If you mean in a Worksheet Module, then that's the problem.
The function should be in a standard module (from InsertModule)

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Diarmuid" wrote in message
...
Hi,

I've just strarted using vba function to automate some of my spreadsheets.
I've created a function in a worksheet, but no matter what I try I can't
seem
to access the function from a cell - any help would be greatfully accepted
--
Just getting used to VBA!!!


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
How to convert cell formula functions to code functions Adnan Excel Discussion (Misc queries) 1 October 1st 08 08:30 PM
efficiency: database functions vs. math functions vs. array formula nickname Excel Discussion (Misc queries) 2 July 14th 06 04:26 AM
Conversion from Spreadsheet Toolkit functions (ESSV....) to EssBase API functions sujay Excel Programming 0 June 5th 06 10:13 AM
User-defined functions created in Excel 2000 fail in Excel 2003 goodguy Excel Discussion (Misc queries) 1 October 3rd 05 07:04 PM
excel functions and User defined functions Kanan Excel Programming 4 May 20th 04 11:21 PM


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