Using Two Cell Entries To Call Range For Function Evaluation?

Sep 7, 2013

In an Excel sheet, in A1 I have written B1 and in A2 I have written D20.

I have a data panel in B1:D20.

I would like to call a vba function my_Fun that acts on my data panel and returns a double in cell A3.

Instead of writing my_Fun(B1:D20) in A3 I would like to be able to write my_Fun(A1:A2), where the entries in A1 and A2 are called, rather than A1 and A2 being used to define the range themselves.

View 5 Replies


ADVERTISEMENT

SUMIFS Function In 2007 (range To Sum, Range To Evaluate, Evaluation Criterion)

Sep 8, 2009

I’m trying to use the SUMIFS function in Excel 2007 to evaluate the following formula:

{=SUMIFS(range to sum, range to evaluate, evaluation criterion)}

The range to sum is A1:A10, the range (dates) to evaluate are in B1:B10, and the evaluation criterion is that the date is before 31/10/1999.

So my formula looks like this:

{=SUMIFS(A1:A10,B1:B10,”<31/10/1999”)}

This works fine, but how do I refer the 3rd argument in the function to a date in a particular cell rather than typing in the date specifically?

View 2 Replies View Related

Continuous Evaluation Of Time Function NOW()

Mar 4, 2008

1) The following formula returns TRUE or FALSE:

=AND($J$15"",(MOD(SECOND(NOW())-1,6)+10) = COLUMN())

It works fine as long as the w/b is busy doing something!

2) Otherwise if the w/b is not busy, the formula appears to be calculated only ONCE at the current time NOW(), and F9 must be pressed repeatedly to re-calculate the formula despite Tools::Options::Calculation is set to Automatic.

3) Is it possible to have NOW() representing a progressive NOW()?

4) If not, can the above formula be modified such that it is evaluated continually for, say, the next 60 or 120 seconds from the current NOW()?

View 9 Replies View Related

Lookup Function Call: Vlookup Call In Sheet

May 21, 2006

I have a work book with 3 sheets. Sheet 1 is the main sheet and sheets 2 and 3 will use (I hope vlookup) to update 3 columns from info in sheet 1. my attempt at a vlookup call in sheet 2 is: =VLOOKUP($b3,[master_AoJ_2.xls]Sheet1!$B$3;$B$65,false)

my understanding is that: - $b3 is the cell in sheet 2 that will be updated as a result of the vlookup call. - [master_AoJ_2.xls]Sheet1!$B$3;$B$65 refers to range $B$3:$B$65 on sheet1 of master_AoJ_2. it does not work... infact I get nothing at all. when I type the call into cell $b3 of sheet2 excel thinks it is stariaght text. this is how I coded the function call =VLOOKUP($b3,[master_AoJ_2.xls]Sheet1!$B$3;$B$65,false)

View 4 Replies View Related

Call Function By Name

Aug 30, 2007

Just wonder how to call the function if I have it's name in the variable String
for example something like that:

View 11 Replies View Related

How To Call The Function

May 10, 2007

I wrote a function procedure in VBA. Pasted it into a 'VBAProject' sheet in my workbook. But when I try to call the function (by entering the name and arguments into a cell), the sheet displays "#NAME?".

What have I forgotten?

example:

Public Function TotDays( _EndDate As Date, _StartDate As Date _) As Integer
TotDays = EndDate - StartDate
End Function

cell
a5: =totdays(b2,A2)
b2: 4/1/2007
a2: 3/1/2007

View 9 Replies View Related

Call An Add-in Function From VB

Jul 12, 2007

I created a file with one sub and one function. Saved it as an add-in. and followed the promts to insert the Add-in.

The button I assigned to the macro works fine, but when I call the function, I am told "Sub or Function not defined".

Is there some special way to call an add-in function from VB?

View 9 Replies View Related

ComboBox To Call Another Function

Sep 24, 2008

How is it possible to take the choice from the Combo Box and send that into a Stored Procedure statement in Excel VBA

I have 3 Combo Boxes, Months, Years, Date.

I'm trying to fillout these into this statement to run my Stored Procedure.

View 10 Replies View Related

How To Call A Procedure / Function

Mar 2, 2012

I have found some code that does what I want- but i do not understand how to use - call it. The programmer says ...

GetNetworkIPAddress()
' can be called from a worksheet cell using the formula:
' =GetNetworkIPAddress()

I have put this in a cell but i ger an error #Name?

what should i do ?

View 9 Replies View Related

To Use A Variable In A Call Function

Aug 12, 2008

I'm playing around with the Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) function. I have a list of people in Column D that I'd like to move data around if the user double clicks on a cell in Column D. The list is about 158 rows long, and could grow beyond that. I've gotten lazy typing:

If Intersect(Target, Range("D4") Is Nothing Then
Exit Sub
Else
{My Code Here}
End If

If Intersect(Target, Range("D5") Is Nothing Then
Exit Sub
Else
{My Code Here}
End If
Etc, Etc, Etc

What I was hoping to do is use a variable (t) to cycle through the rows and call the various functions. So what I came up with is:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Application.ScreenUpdating = False
On Error Resume Next
Dim t As Integer
Dim Subtest As String
For t = 4 To 158
Subtest = "D" & t

I've created Sub D4(), Sub D5(), and Sub D6() as a test. This didn't work at all as it's looking for a Subtest(). Also, clicking on D5, D6, didn't do much either. Is there any way to make this cycle work, or should I keep typing away?

View 9 Replies View Related

Function Call To UserForm (VBA)

Aug 23, 2006

I wanted to have that one appear whenever a certain cell in a certain sheet gets a specific value, and depending on the answer of the user the Form should set the value of some other cell. So maybe there´s a much simpler solution to this task than what I tried - and I´ll be grateful to learn about it.

Anyway I tried the code which follows below - and it works just fine when I call it from the VBE environment - but inside the UserForm it just stops in between (without any error message) when I operate it from the Excel sheet (but still succeeds with the function). I´ll be very happy if someone could solve this "miracle" for me (even IF there´s a better solution altogether). So I just provided a simple Function which does nothing but call the UserForm and is executed whenever the condition is met (some calls to MessageBoxes in between just have been added to see how far the code gets executed): Function:

Public Function Call_my_form()
Call Option_Form.Show
MsgBox "Call executed"
End Function

Call of the function: =If(E11="Go";Call_my_form();"Nothing")

The UserForm just uses two OptionButtons with code as follows (two versions to check whether one of these would be the reason - both do behave the same way):

Private Sub OptionButton1_Click()...........................

View 5 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

Validate Cell Entries To Named Range List

Apr 28, 2009

I have been trying to figure out how to use a named range (on another sheet) to validate the user entered data in a specific column. All my attempts at utilizing worksheet_change event have ended in errors. I've created a simple workbook that shows what I'm trying to do and have attached it to this message. The 'Sample (Data)' worksheet has the data table that would be completed by the user. On the 'Validation' worksheet I have named the range to be used to validate the data as 'rngVal'. So when something is entered under the 'Expense Type' heading, the code would verify that the value entered was contained in the 'myVal' validation list. If it was not present in the list, a msgbox would instruct you to try again. After stealing bits of knowledge and code from many of the posts on this site I cobbled together the following (which results in an error at the 'set rngFind' line):

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngFind As Range
'Set Target = Cells(ActiveCell.Row, ActiveCell.Column)
Set rngFind = Range("rngVal"). Find(Target.Value)
'If data in column C changes, do the following
If Target.Column = 3 Then
'If the value is found on the validation list, do nothing.
If rngFind Is Nothing Then
Else
MsgBox "You must enter one of the following in this cell:"
With Application
.EnableEvents = False
.Undo
.EnableEvents = True
End With
End If
Else
End If
End Sub

View 6 Replies View Related

Call Combobox_change Function On Exit.

Dec 22, 2009

I'm using an activex combobox in excel. It display 4 posible choices, and one of them is "Other". When someone select "other" there is a textbox named "tb" that should be filled. Otherwise tb should be invisible. Combobox change() function looks like that:

View 14 Replies View Related

Function To Call Another Worksheet Query

Jan 9, 2006

I have a spreadsheet with 5 worksheets representing the working days of the week. Each worksheet contains data pertaining to every occurance of that day for as long as it has been recorded. Each day is broken up into hourly data.

So for example, for Monday's worksheet, you would have

Col A..............Col B........Col C
9/jan/06........5am.........data
9/jan/06........6am.........data
9/jan/06........7am.........data
...etc....then...
2/jan/06........5am.........data
2/jan/06........6am.........data
2/jan/06........7am.........data
...etc....

We are trying to create a function, on another worksheet called Query. The only way I can describe what we want it to do is to do it in psuedocode.

Psuedo........................................

View 10 Replies View Related

Function Call To Set The Password Of The File

Apr 23, 2007

I found a function to set the password a an excel file:

=========================================
Function SetPwd(strNoPwdFile As String, _
strPwdFile As String, _
Optional strOpenPwd As String, _
Optional strModPwd As String) ' As Boolean
' This function requires the following arguments:
' strNoPwdFile - The path to a document without a password.
' strPwdFile - The path and name to save the password-
' protected document.
'
But the compiler said that it is syntax error.

How can i rectify the error?

View 9 Replies View Related

Call A Function With A Macro/button

May 23, 2006

I want to call on a function with a macro/button in the same way as when you choose "insert-function" but in a way that the user himself is able to put in values on the spredsheet.

View 7 Replies View Related

Call Function At Each Iteration Of Solver

Mar 27, 2008

I have a written a small sub to run solver. However, I need to run a secondary sub at each solver iteration. The secondary sub I want to run is called “BypassGoal”.
My code currently looks like:

Sub OperatingPt()
Dim WrkBk As Workbook
Dim WrkSht1 As Worksheet
Set WrkBk = ThisWorkbook
Set WrkSht1 = WrkBk.Worksheets("Engine")
Dim Mode As String
Dim CellTarget As String
Dim CellRange As String
WrkSht1.Activate
WrkSht1. Cells(30, 2).Value = 2
CellTarget = "H14"
CellRange = "B30"
SolverReset
SolverOptions Iterations:=3000, Precision:=0.000001, AssumeNonNeg:=True, Derivatives:=2, StepThru:=True ....................

View 2 Replies View Related

Dir Function - Invalid Procedure Call Or Argument

Jun 25, 2013

When I step-through my code below, it always opens the first file in the directory "C:Pyramid Files", but when it comes back to the Pyramid Files sub after fully processing the first file via various other subs, the VB Editor apparently doesn't like something about this line: StrFile = Dir(), since it quits after "snapping-back" to the previous sub Initialize(). I have also tried StrFile = Dir, but that doesn't work either. I did Dim Strfile in the General Declarations. When I set Watches for Dir and Dir(), I get the value "Invalid procedure call or argument" for both, as if the directory function lost the value. I can't determine why this is happening.

VB:
Dim WSM As Worksheet, WSB As Worksheet, WS1 As Worksheet, [U]StrFile As String[/U], StrDirectory As String, ClientCode As String
Dim Filename As String, LastRowb As Long, LastColB As Integer, LastRow1 As Integer, NextRowC As Integer, x As Integer, y As Integer

[Code] .......

View 4 Replies View Related

Invalid Procedure Call Or Argument In Function

Aug 30, 2012

This error message in line vpp:

Invalid procedure call or argument

Code:
Function fn1(ByVal a, ByVal i, ByVal e, ByVal N, ByVal w, ByVal ta)
Pi = Application.WorksheetFunction.Pi
mhu = 398600
vpp = (mhu / Math.Sqr(mhu * a * (1 - e ^ 2))) * (-Math.Sin(ta * Pi / 180))
fn1 = 2 * vpp
End Function

View 9 Replies View Related

'C:Documents...' Inside Worksheet Function Call

Jan 25, 2008

I have a spreadsheet that uses a function defined in VBA code that is housed in an add-in which is stored in the default location (C:Documents And Settings{user_name}Application DataMicrosoftAdd-Ins). To share this spreadsheet, I first install the add-in on the other person's computer. Then, when the other person opens the spreadsheet, the function doesn't work because the function call on the worksheet contains the whole path of the add-in (and the path contains my {user_name} rather than the other person's). So, the immediate solution is to just delete the path of the add-in from the function call (so that only the name of the function remains, plus the arguments of course). But this is quite inconvenient given the number of times the function appears in the worksheet, and it's not practical as we continue to share files like this.

My question is: is there a way to make sure that the 'C:Documents...' never gets added to the function call in the first place? I mean, why doesn't Excel just try to run the function locally before it adds that path that refers to a separate computer? I do realize that there are other methods of sharing VBA code. For example, I know that I could include the code in the specific spreadsheet that I'm trying to share, and this would work. But, that's not the answer I'm looking for (for one, the function refers to a very large amount of data stored in the add-in, and there are other reasons that make the aforementioned method impractical). I'm wondering if I'm missing something, and if there is a way to stop Excel from tacking on the path string to the function call, so that the function would just work on any computer as long as they have the add-in installed?

View 9 Replies View Related

Call Public Function From Class Module

May 25, 2006

I have written a public function inside a class module. Is there anyway I could call the public function in Excel? What is the exact syntax to do it?

View 5 Replies View Related

Contiguous Vs. Noncontiguous Cells Used In A Function Call From VBA

Aug 2, 2006

I am working with several columns of data, and each column's range is stored in a range array. My program needs to use a specififc combination of the columns as the second argument sent to the regress function. In certain cases, the columns I am referencing are not contiguous, so the function won't work. Here's an example:

Suppose we're working with 3 independent variables (a simple case) whose data is stored in three contiguous columns named x1, x2, and x3. The program I've written will call the regress function 6 times: once using x1, once using x2, once using x3, once using the union of x1 and x2, once using the union of x1 and x3, once using the union of x2 and x3, and once using the union of x1, x2, and x3. Suppose the range for x1 is d5:d18, the range for x2 is e5:e18, and the range for x3 is f5:f18. Also, each union of ranges is stored as one element in an array called Combos, which is sent to the regress function.

The regress function returns an error when prompted to calculate regression stats for columns x1 and x3 because they aren't contiguous. I need to know if there is some sort of way around this. write a procedure that will detect if the ranges being input to the regress function are contiguous, and if they are not, copy them to a new worksheet so they will be contiguous and then send the new range references to the regress function for calculation purposes? Is there an easier way around this issue? If I can't get this to work, my entire program is wasted.

View 3 Replies View Related

Compile Error: = Expected After Function Call

Dec 18, 2006

i'm trying to call a function from another one, i'm getting this error 'Compiler error: = expected' but i don't know the reason, the functions simply take some values an store them in an here is the

Dim productos(19, 3) As String
Sub agregarProducto(ByVal descripcion As String, ByVal modelo As String, _
ByVal precio As String, ByVal unidad As String)
Dim r As Integer
For r = 0 To 19
If productos(r, 0) = "" Then
productos(r, 0) = descripcion
productos(r, 1) = modelo
productos(r, 2) = precio
productos(r, 3) = unidad
End If
Next
End Sub

Sub agregarProductoTelas()
Dim descripcion, modelo, precio, unidad As String
If Selection.Column = 1 Then
descripcion = Selection. Offset(0, 0).Value
modelo = Selection.Offset(0, 0).Value
precio = Selection.Offset(0, 3).Value
unidad = Selection.Offset(0, 2).Value
agregarProducto(descripcion, modelo, precio, unidad) 'error happens right here
MsgBox (descripcion)...

View 3 Replies View Related

For EACH Cell In Specific Range Meeting Specific Criteria - Call Sub

Jul 1, 2014

Looking to have a macro call a subroutine every time it finds a cell meeting specific criteria.

Code in plain english would look like this:

For EACH cell in range A1:BZ500 meeting the following criteria:

Cell value is a date

AND

Cell's date is at least a week or more in the future

AND

Cell background (Fill) = RGB color code: (R:191 G:191 B:191)

DO the following:

Call repeatingsub

View 11 Replies View Related

Excel 2010 :: Call Function In Another AddIn (XLAM)

Jan 10, 2013

I try to call a function/procedur in an Excel2010-AddIn (.xlam file) from another Excel2010-AddIn (.xlam file):

Code:
Application.Run (filename.xlam!functionname)

Both AddIn-files are in the same directory (the default AddIn directory).

This call causes the error message "runtime error 91: object variable or with block variable not set".

This problems came up with providing an existing Excel2003-AddIn for Excel 2010.

The same code runs in following cases:

1. call a function in an Excel2003-AddIn (.xla) from another Excel2003-AddIn (.xla)
2. call a function in an Excel2003-AddIn (.xla) from a Excel2010-AddIn (.xlam)

View 1 Replies View Related

Create Array From Row By Row Evaluation?

Apr 15, 2014

As part of a larger formula, I need a way to evaluate a range row by row and generate an array with the results. More specifically, I need to evaluate whether at least one of the cells in a row has a specific value.

So given the following table:

1
1

1
2

2
1

2
2

3
3

When querying the table for the value "1", it should result in the array {TRUE, TRUE, TRUE, FALSE, FALSE}.

How can I achieve this?

View 4 Replies View Related

Code Evaluation For Efficiency

Sep 18, 2007

It is to large to upload here and I have removed the sensitive data that would normally be present. The part I'm currently stuck at is the multiple search criteria, one part works while the other does not. Also, I have yet to discover a way to indicate to the user that the correct Row is selected and being edited in the right cells.

View 2 Replies View Related

IF Formula- Created A Non-subjective Job Evaluation Spreadsheet

May 2, 2007

I have created a non-subjective job evaluation spreadsheet, which takes data obtained from a work daily of an individual and is implemented in my spreadsheet. The columns of areas to be evaluated will average each individuals performance by averaging the individual to the rest of his shifts performance and a point system has been established depending on their work level. The situation I'm running into is I'm using the formula below to establish my point system. In an effort to be fair in every way possible, should a particular column end up with all zeros "0" this would then become the average, which should provide the individuals in this group with three "3" points. My forumula as it is set up will now only give one "1" point, when it should be three. The point system works great other than this one particular problem, when everyone has a zero. I'd sure appreciate anyone's suggestion how I might be able to add one more IF statement to this existing formula. Note: I29 is the cell for this particular column that represents the average of the column with data in it. I28 is 10% above average, I27 is 20% above average, I30 is 10% below average and I31 is 20% below average.
point system is 1 point for 20% below average, 2 points for 10% below average, 3 points for average, 4 points for 10% above average and 5 points for 20% above average.

=IF(ISTEXT(I3),0,IF(I3="",0,IF(I3<=$I$31,1,IF(I3<=$I$30,2,IF(I3<=$I$29,3,IF(I3<$I$28,3,IF(I3>=$I$27, 5,IF(I3<$I$27,4))))))))

View 10 Replies View Related

Count All Year To Date Values That Have Evaluation Result

Jun 24, 2008

I'm trying to find a formula that will give me a count of all programs by month that have an evaluation result. So, in column A1:A24 I have a list of programs with. In cell A25, I have the total number of programs. In column B1:B24, only 7 of those programs have evaluation results, some of the rows are blank.

I know that I can get a sum of the programs by month, but how do I only get a count of those with an evaluation result? What formula can be used to get a year to date (a running count), not a count based on 12 months? Meaning that we would need a year to date for each month, so currently for October to June (based on fiscal). If we based it on year to date, then I think we would have to divide be 12 and that would make the results inaccurate.

View 2 Replies View Related







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