Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to convert cell formula functions to code functions | Excel Discussion (Misc queries) | |||
efficiency: database functions vs. math functions vs. array formula | Excel Discussion (Misc queries) | |||
Conversion from Spreadsheet Toolkit functions (ESSV....) to EssBase API functions | Excel Programming | |||
User-defined functions created in Excel 2000 fail in Excel 2003 | Excel Discussion (Misc queries) | |||
excel functions and User defined functions | Excel Programming |