Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
defign a function in one workbook and use it in another workbook
I am trying to open a workbook eg book2.xls from vba code in book1.xls and
want to then use a user defigned function defigned in book1.xls in book2.xls. I can open book2.xls ok and can insert columns and paste 'normal' excel functions into the cells but want to paste a user defigned function in and cannot work out how to do it. Any help greatly aprechiated. Dean. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
defign a function in one workbook and use it in another workbook
=mybook.xls!myfunc()
-- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Dean@ERYC" wrote in message ... I am trying to open a workbook eg book2.xls from vba code in book1.xls and want to then use a user defigned function defigned in book1.xls in book2.xls. I can open book2.xls ok and can insert columns and paste 'normal' excel functions into the cells but want to paste a user defigned function in and cannot work out how to do it. Any help greatly aprechiated. Dean. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
defign a function in one workbook and use it in another workbook
The following code works:
Columns("W:W").Select Selection.Insert Shift:=xlToRight Range("W1").Select ActiveCell.FormulaR1C1 = "ERROR SUBMISSION DATE" Range("W2").Select ActiveCell.FormulaR1C1 = "=IF(RC[-1]="""",""ERROR"","""")" Range("W2").Select Columns("W:W").EntireColumn.AutoFit Set SourceRange = Range("W2") Set fillRange = Range("W2:W" & howmany) SourceRange.AutoFill Destination:=fillRange Columns("W:W").Select Selection.Font.ColorIndex = 3 Range("W2").Select But instead of the If statement I want to run: Function dean1(rdl1 As String, rdl2 As String) Dim rdla As String If rdl1 = "Lab1" Or "Lab2" Or "Lab3" And rdl2 = "" Then rdla = "Error" Else rdla = "" dean1 = Trim(rdla) End Function Don't know if this helps! Cheers, Dean. "Dean@ERYC" wrote: I am trying to open a workbook eg book2.xls from vba code in book1.xls and want to then use a user defigned function defigned in book1.xls in book2.xls. I can open book2.xls ok and can insert columns and paste 'normal' excel functions into the cells but want to paste a user defigned function in and cannot work out how to do it. Any help greatly aprechiated. Dean. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
defign a function in one workbook and use it in another workbo
Thankyou Bob, that's sorted it.
"Bob Phillips" wrote: =mybook.xls!myfunc() -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Dean@ERYC" wrote in message ... I am trying to open a workbook eg book2.xls from vba code in book1.xls and want to then use a user defigned function defigned in book1.xls in book2.xls. I can open book2.xls ok and can insert columns and paste 'normal' excel functions into the cells but want to paste a user defigned function in and cannot work out how to do it. Any help greatly aprechiated. Dean. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
REPT FUNCTION FROM WORKBOOK TO WORKBOOK | Excel Worksheet Functions | |||
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook | Excel Programming | |||
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? | Excel Programming | |||
Call function from one workbook that resides in another workbook m | Excel Programming | |||
What commands do you use to name a workbook, save a workbook,open a workbook | Excel Programming |