Run A Sub Or Function In A Seperate Workbook Using Vba

Jan 28, 2009

I've seen that you can set up a reference and that may be the only way, but my guess would be that it is not the only way.

I'd like to open and run a sub from a different workbook (in the same folder) using vba. For example, test1.xls would have a sub that would open test2.xls and run a sub from test2.xls before closing and returning to test1.xls.

View 9 Replies


ADVERTISEMENT

Dynamic Workbook Within A Formula.: Look Up A Value Within A Seperate Workbook

Mar 27, 2009

I am creating a formula - that will look up a value within a seperate workbook. I want the workbook reference to change based on a cell which contains the date.

So workbook name is "Report 120309.xls"
Cell: A1 contains the date "120309"

Current formula ='[Report 120309.xls]Sheet 1'!$F$50. Can I replace the data within the formula with the date in the cell.

View 2 Replies View Related

Get UserForm Names From A Seperate Workbook

Mar 6, 2006

I'm working to develop a method to programmatically identify the type of object contained in a UserForm, it's relevant property(s) & their current values.

Currently, I'm importing the relevant form into a new form module within the VBA Project. I'd like to be able to set the Workbook & Userform as variables within the code & do away with the import step. It appears the target workbook can be addressed by using the statement,

Set my_Workbook = CreateObject(Application. GetOpenFilename)

However I'm coming unstuck with the correct syntax to address UserForms in another workbook.

View 6 Replies View Related

Open Workbook In Seperate Program

Jun 22, 2007

I want to know if when you open an excel file from the desktop is it possible to have that paticular file open in a new Excel program instead of one that is already opened. A more specific senerio is that I have Excel running a program and if i open from the desktop it opens it in that paticular excel program. I can open excel a second time and have to seperate excel programs running. Is it possible that when I open a paticular excel sheet from the desktop that it opens in a new excel program besides the one that is already running.

View 3 Replies View Related

Text To Columns: Split Data In Seperate Seperate Coloumn

Jul 23, 2009

Attached file where i m not able to split data in seperate seperate coloumn

View 3 Replies View Related

Export TextBox Data To Seperate Workbook

Mar 3, 2008

I have built a simple little logger forlogging insurance policies set up without permission, at the moment it logs all data in sheet2 of the active workbook. What I want it to do is when submit is clicked is to export and save the data to a seperate (central) workbook to collate all entries and not to save it in the active workbook. I've inlcluded the file and the code is as follows;

Private Sub CommandButton1_Click()
Dim ws As Worksheet, lRow As Long, Str As String
Set ws = Sheets("Sheet2")
lRow = ws. Range("A" & Rows.Count).End(xlUp).Offset(1).Row
'____error handling______
If TextBox1.Value = "" Or NullString Then
MsgBox "Ooops, it seems you haven't entered a policy number!", vbCritical, "Error..."....................

View 2 Replies View Related

How Can I Activate An Open Workbook By Macro In Seperate Instances

Feb 24, 2009

I have a program that has all Excel Workbooks in seperate instances of Excel. There is a very sound reason for doing this.

The user has maybe 3 to 10 workbooks open. There are times when a workbook is active and has a Macro Link to open one of the already open workbooks.

When the user clicks the link, they naturally get an error message stating that the workbook is already open. Then they have to close the error msg and click on the Macrosoft Tab and look thru the list of open workbooks and then click the one they are looking for. Additionally, in this Menu Program the user really doesn't even have to know the name of the various workbooks.

I hope everyone will believe me when I state that this program works berautifully.

Right now I am simply cleaning up and making a few little things work better.

QUESTION When the user clicks on a macro link that is to open a workbook that is already open, how - On error - can I have the macro continue on and activate the requested workbook - - - Please remember they are all in separate instances of Excel.

Since the code I'm using can determine if the requested workbook is already open, I think there has to be a way to activate that workbook.

View 14 Replies View Related

Use The Networkdays() Function In A Workbook

Dec 27, 2006

In order to use the networkdays() function in a workbook im working on i need to get the Analysis ToolPak add-in installed on my pc.

Will this workbook function correctly if opened on a pc that does not have that particular add-in on it?

View 9 Replies View Related

Call Add-in .xla Function From Workbook

Apr 3, 2008

I have created an Excel add-in (.xla) which contains many custom functions. This add-in is stored as read-only on a network drive. I reference it from various spreadsheets and calls to it work perfectly unless I put a call to it in the Workbook_Open event. When I make a call to a function in the add-in from a spreadsheet's Workbook_Open event, Excel crashes completely and I get the dialog that offers to recover the file and report the problem (i.e. Excel shuts down). I have no doubt that this is being caused by the call to the add-in specifically from the Workbook_Open event as removing this call solves the problem. Also, it is not related to a particular function as I have tried various ones; it is ANY call to the add-in from Workbook_Open that causes it. Is this a bug in Excel or is there something that I need to do before referencing the add-in in Workbook_Open? I have tried Application.CalculateFull and Doevents prior to making the call to the add-in and neither approach worked.

View 2 Replies View Related

Find Function Not Working In Workbook

Aug 13, 2014

I'm in a workbook, and I want to look up a name. CTRLF or clicking on the binoculars both bring up the expected dialog box, but when I populate "Find What" and either hit enter, click Find All or Find Next, nothing happens.

The only thing I can think of is that I created a macro to function in one sheet only, then saved this workbook as .xlsm. But that doesn't seem right.

View 1 Replies View Related

Function Runs Within Workbook But Not As AddIn

Feb 6, 2014

When running the following code for NSLookup in a module within the current workbook, it runs fine but when I put it in a XLAM file and try and use it as an addin I only get #NAME? as a result. I believe that that addin is installed properly because I have a second module with a sub routine in it (GetIPStatus) that is working, and when entering the command =NSLookup(A2) in a cell it shows up properly like it's an available function, but it does not seem to execute. Do I have to do anything special for a function to run as an addin?

View 4 Replies View Related

Search Function Over Entire Workbook

Oct 30, 2009

I have a form that searches in an entire workbook for certain keywords, for example I fill in a last name in the textfield txtName and pus the search command button. As a result I get all the rows of the entire workbook containing this name. There are othre search fields in the form that do similar things...

This is the vba

View 10 Replies View Related

Execute Function When Workbook Closes

Feb 22, 2010

I'm looking for a way to execute some code, when the user closes the workbook/excel.
So far, I've found this

View 3 Replies View Related

HYPERLINK Function To A Second Worksheet In One Workbook

Dec 11, 2008

I'm having a problem with the HYPERLINK function. I am trying to make jumps from an index sheet to the large worksheet with all the actual info in it. The name of the file is SKU and the large info sheet is also called SKU. First I took the SKU sheet and numbered the rows (="A"&CELL("row",A1)), then in the index worksheet I created a VLOOKUP that finds the corresponding chapter title and returns that value.

Worksheet 1

A B C
1
2 100 =VLOOKUP(A2,SKU!$A$1:$B$3,2,FALSE) ="[SKU]SKU!"&VLOOKUP(A2,SKU!$A$1:$B$3,2,FALSE)
3 150 =VLOOKUP(A3,SKU!$A$1:$B$3,2,FALSE) ="[SKU]SKU!"&VLOOKUP(A3,SKU!$A$1:$B$3,2,FALSE)

I used the HYPERLINK formula in column D: "=HYPERLINK(C2,A2)" and it returns something that looks like the right thing but the link won't open.

View 2 Replies View Related

Offset Function Linking To Another Workbook

Jun 20, 2007

ive managed to come up with this formula: = OFFSET( 'G:gailMVTR2007[B052,B261A.xls]B261A45'!$B$5,COLUMN()-3,0,1,1)

which pretty much does the same job as a paste special/translate, this works fine when both files are open and updates all the values that i could ever enter, however, when i open only the file containing the link and press "update" it returns a "#value!" error, i dont understand because it works fine when the other sheet is opened and there are no values other than a single number used.

View 6 Replies View Related

Workbook>Beforesave Function To Add Cell Borders

Feb 9, 2010

I have a spreadsheet that I'm working on and I'd like to include a beforesave macro to format the spreadsheet. Basically I need a macro to select all rows with data in column 'a' and add a thick border to the top of the cells. Ideally the border would stop at column 'i' but that's not essential. I've attached an example of what I'd like. I've included 2 sheets 1 called 'before' and 1 called 'after'. They show what I'm after.

View 3 Replies View Related

Function To Get Full Path Of Workbook In Cell?

Oct 26, 2011

The folder which contains the Excel file I'm working on is

C:Usersar3DocumentsKey Performance Indicators

however if I place =INFO("directory") in a cell I get

C:Usersar3Documents

Is there a function where I can get the full path of the workbook in the cell?

View 2 Replies View Related

Can Use Cell To Find Workbook Name In VLookup Function

Jun 23, 2012

what I am trying to do but I'll give it my best shot with examples.

A1 = date

B1 = drivefolder[A1.xls]sheetname'!cell

View 1 Replies View Related

Will VBA In Place Of A Function Reduce This Workbook Size

Mar 5, 2009

I know that VBA doesn't always slim down workbook size and calculations are calculations whether in VBA or Formula format; but in this instance, do you think VBA would be a better choice? This workbook is currently enormous in size and slow, and I think I can slim it down if I used the right VBA procedures. However, Im not certain what those procedures would be.

On two seperate worksheets in a workbook, I have a column that contains a formula that references a third sheet.

Sheet 1 = "Order"
Sheet 2 = "Turn-in"
Sheet 3 = "Bank"

Ok, here's the scenario: On the "Order" sheet, I have a list of orders from my company; on the "turn-In" sheet, a list of turn-ins. The "Bank" sheet lists ALL transactions (ORDER AND TURN-IN).

On both the turn-in and Order sheets, the formula is pretty much the same; it references a different column on the bank sheet, but does it the exact same way. Ok... The Order sheet lists all order from the company by order number (column A); the formula uses that order number and finds the transaction on the "Bank" sheet and returns the order cost as the result. however, the order numbers on the bank sheet have a 5 digit prefix on them (the prefix is the same on all orders, its used by the bank but only orders with my 5 digit prefix are on the list sent to me and pasted to this sheet. So all orders on bank sheet have the same prefix)

The below formula is in Cell C10 on "Order" Sheet; Column C lists the Cost reported by the bank. The formula below references the Bank sheet database, looks for an order number that matches the order number in A10 (Adding the prefix of course), and returns a cooresponding cost for that transaction.


=IF(ISBLANK(A10),"",IF(COUNTIF(BANK!$A$4:$W$10001,("ECGGT"&A10))>1,"",SUMIF(BANK!$A$4:$W$10001,"ECGGT"&$A10,BANK!$F$4)))

I know this seems long for what it is, but it has to add the prefix, and then match the order number, and reference the cooresponding cost.

The kicker, this forumla is in more than 10,000 cells; 6,000 on the order sheet, and 5,000 on the turn-in sheet. Of course the references are a little different, but the principle is the same for all of them.

Is there a way to do this in VBA to save space and resources? This formula is really dragging.

View 9 Replies View Related

Function/Formula To Determine If Workbook Open

May 16, 2008

how do you set a return value for a function in VBA? I've looked at examples of functions and I don't understand.

All I want to do is call a function to see if a workbook is open and have it return true or false. Here is the code I have, but it won't let me use go "Return isOpen" at the end like VB would! The IDE complains.

Function IsWorkBookOpen(ByVal name As String) As Boolean
Dim wBook As Workbook
Dim isOpen As Boolean

wBook = Workbooks(name)

If wBook Is Nothing Then
isOpen = False
Else
isOpen = True
End If

'I can't reutrn the value of is open?
Return isOpen

End Function

I've noticed other VBA functions I've looked at don't use "Return"....how does does the function return a value then?

View 3 Replies View Related

Getting Averages From Seperate Worksheets

Dec 9, 2009

The first one, I do i remove #DIV/0! from cell O7 in the worksheet "My overview"?

The second one, I need to get averages of the QA score for the 3 months from January to March in the worksheet "My Overview" Cell E14 for the corresponding person on each sheet. I understand that there need to be values in place to get an average but is there a way to overcome this?

View 2 Replies View Related

Sum If, But The Sum Range Is Seperate Cells ?

Oct 8, 2008

I want to do a simple Sum if. My range is simple and so is my criteria, but the actual range of cells to sum is not in one continus row or column. Can I do the sumrange as seperate cells?

View 3 Replies View Related

Consolidating 4 Seperate Worksheets

Oct 21, 2006

I have 4 worksheets where the structure is exactly the same except the figures differ

The worksheet have text and values in columns A to S. I need to write VBA code that will combine the data and show the descritions in a consolidated woorksheet.

View 9 Replies View Related

Seperate Names From Numbers

Apr 27, 2007

I have the following list of names, phone and radio numbers that somebody put together all in one cell. Formated as General with Word Wrap.is.

View 9 Replies View Related

VBA: Seperate Vba Code From File

Aug 14, 2008

Is there a way to put vba code to a standard alone exe file? This way, I don't have to keep update the code on different excel files.

View 9 Replies View Related

Seperate Text In A Column

Oct 4, 2009

Is there a simple formula that can be used to seperate text in a column.

Example:
ABC - 123456
I want to return the text before the "-".

View 9 Replies View Related

Formula Seperate The Column

Oct 29, 2009

I have columns with titles at the top, and with numbers in the below cells.

What I would like is a formula for a column seperate to these that firstly, looks if there is a quantity in the relevant cell on that row, secondly takes the title (top cell) of that column, and thirdly puts the number in the cell on that row after the title:

A_____B_____ C_____ D_____ E______ F
1_____UK____ Ger___ M/E___ Rus_____ Nor
2_____80_____250___ 300___ 350_____200
3____ 60_____200____350____350____ 150

So in cell A1, I would like a formula that reads the subsequent cells and their titles, and gives a one-cell summary of the data seperated by commas. So in A1 it would say:

UK 80, Ger 250, M/E 300, Rus 350, Now 200

And in A2:
UK 60, Ger 200, M/E 350, Rus 350, Now 150

View 9 Replies View Related

Seperate Decimal & Whole Number

Sep 21, 2007

How do I seperate 1.2 and 1.02 miutes from the same column into Minutes and Seconds Correctly.

How do I get the first to seperate as (1) Min (20) Secs and the next to
seperate to (1) Min (2) Secs

I have 200,000 line of data in one column with times from .o1 mins to 1498.40 mins that I am doing this to. I need to convert it all back to seconds.

View 4 Replies View Related

Use COUNTIF Function To Retrieve Data To A Report Tab On Workbook?

Jul 13, 2014

I am trying to use COUNTIF function to retrieve data to a "Report" tab on my workbook.I need it to be count if as I have 2 criteria whether or not the value in the cell should be counted toward the sum (one is text basically saying "Y" and other the date). Now the formula worked fine when use hard data such as this:

=COUNTIFS('Inspection Report'!$B$3:$B$1048576,"*" & "06/05/2014" & "*",'Inspection Report'!E3:E1048576,"Y")

OUTCOME: 47 (which is correct)

See how I used the date there, I typed it myself. However the end user should not be able to have access to the formula, so I used a cell with drop down list and the date is stored there. So following the logic, my new formula should be this:

=COUNTIFS('Inspection Report'!$B$3:$B$1048576,"*" & C2 & "*",'Inspection Report'!E3:E1048576,"Y")

OUTCOME: 0 (which is incorrect)

how the date is stored. By following my logic this should work as the cell only holds a string value and should be used like this in to calculate the result. if I need to use only the value of the cell in a formula like this should there be any conversion so excel understands what I am trying to do?

View 5 Replies View Related

Finding Duplicates In Two Seperate Columns

Sep 16, 2008

This should be an easy one, it has slipped my mind.

I have columns A and B, I want to find any names that appear in both column A and column B. I want them to show in a certain color.

View 11 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved