Sub With Argument Using External Values
Sep 24, 2012
There are 100 loans, each one of them need to be tested on 11 different tests, the results are either "pass" or "fail". All the test results are stored in the Boolean array. g_sel_tag(). For instance, if g_sel_tag(2,7) = true that means the 2nd loan has failed on the 7th test.
But I got stock with the following code, I think there should be a loop for the public variable rep_num in order to loop through the 11 test results for each loan. I have searched the entire project but did not find any value was assigned to the variable rep_num. The following code is part of a huge project, I can't test run it to see if the following code is valid at this point.
I am new to VBA therefore wondering if it is valid with no specific value assigned to rep_num. (I think there should be something like "for rep_num = 1 to 11" in order to get it running).
There are several codes in the project with similar structure where they just use rep_num without assigning any specific values.
Code:
Dim rep_num As Interger
Sub test_results_reporter (rep_num As Interger)
Dim i As Interger
Dim g_sel_tag(1 to 100, 1 to 11) as Boolean
For i = 1 to 100
If g_sel_tag(i,rep_num) Then Msgbox "Loan" & i & "has failed on test" & rep_num
Next
End sub
View 2 Replies
ADVERTISEMENT
May 20, 2014
I have a big excel sheet with number plates and attributed to them: velocity, times, dates, etc. In the second external source i have csv with another data, now without anything more than number plate & car type. I want to merge this data in the way that i would have information of car type in the excel worksheet with number plates and dates (so essentially merge the second with the first.
It's more than possible that in the second file number plates will be attributed to more than one type of car, as this process was done automatically.
View 6 Replies
View Related
Nov 24, 2008
Due to the large number of VLOOKUP functions on my page of data whenever I try to save I get the following error codes. Excel cannot complete this task with available resources. Choose less data or close other applications. Unable to save external link values. The problem itself may not be solvable but is there away to prevent these messages from coming up when I save (or when it autosaves?)?
View 2 Replies
View Related
Nov 11, 2008
I have an external file that is a table with 4 columns and about 25 rows
I would like to copy the contents of a file into a collection so I can analyze the data.
The problem is, I only know how to copy a whole line as a string and have no idea how to copy the data from the same line into different variables.
I also have no idea how to define a collection array
I will explain
say my text (data.txt) file looks like this:
AB 0.5 20 2/2/07
CD 0.2 15 2/2/07
FE 0.4 40 2/2/07
(example of input)
I would like to create a collection called trade which I have defined like this (obviosly wrongly)
Dim Trade() As Collection
Dim bs As String
Dim quant As Long
Dim price As Single
Dim calendar As String
Trade.Add (bs)
Trade.Add (quant)
Trade.Add (price)
Trade.Add (calendar)
so I would like to know how to define the collection array and how to input the data so that I don't have to insert a whole line into a string variable but can, instead break apart the line during the input stage
View 9 Replies
View Related
Apr 17, 2008
Is there a way of writing a formula to create a reference to an external spreadsheet? I have a folder containing 100s of workbooks all based upon a template. I can create a directory listing of this folder using a macro within Excel.
e.g.
Directory listing
C:My DocumentsReturnsFile1.xls
C:My DocumentsReturnsFile2.xls
C:My DocumentsReturnsFile3.xls
I would then like to use this list of file paths to create links to several different cells within worksheets contained in each of these. I know that if I did this manually for each worksheet the formula would be a variation on =[C:My DocumentsReturnsFile1.xls]Sheet!Cell. Is there a way that I can automatically create these external references? i.e using values in column A (directory listing) to create many external references, say in column B
I use my directory list and then a formula or macro populates automatically these external references? The file names in the directory change daily (100s of worksheets!) so I don't want to have to manually input these each time. If the folder containing the workbooks was held on an intranet would there be a similar solution?
View 2 Replies
View Related
Jan 8, 2013
I want my IF function to populate two cells with two values if argument for IF function is found TRUE. Is it possible?
IF(logical_test, [value_if_true], [value_if_false])
value_if_true = return multiple values in mutiple cells (for example put number 8 in cell A2 and number 10 in cell A3 if function is TRUE)
How would I do that? I tried putting IF(logical_test, (A2="8",A3="10"), [value_if_false]) but it is not possbile...
View 3 Replies
View Related
Feb 20, 2014
I am using Excel 2010. I am trying to make a spreadsheet where I can type in a date (02-19-2014), and pull in box scores from a basketball website. I have everything set up so that the date is parsed into (3) cells (02 19 and 2014) so that it can easily fit into the URL:
[URL]
As you can see, the month value in the URL is "02" the day value is "19" and the year value is "2014". What I want to be able to do is type in any date I want and return the box scores from that day in a new tab. I have everything done so that the new tab is automatically created and named, so my only issue is that I can't figure out how to input the day, month and year values automatically into the code for the Get External Data pull:
Code:
'Import from www.basketball-reference.com
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.basketball-reference.com/friv/dailyleaders.cgi?month=02&day=19&year=2014" _
, Destination:=Range("$A$1"))
.Name = "dailyleaders.cgi?month=02&day=19&year=2014"
View 2 Replies
View Related
Mar 25, 2014
Say I have Source Workbook X 1, and Destination Workbooks X 4. The Source workbook contains a number of lookup values. I want the lookup values to be maintained in the single Source workbook, and I want this workbook to remain closed when the end users are using their Destination workbooks. It is critical that certain cells in the Destination workbooks have validated data in order for formulas and summarizations to be correct.
I'm happy if the Destination workbooks contain a lookup worksheet (perhaps hidden). In short, I'd like the contents from the Source workbook, Lookups worksheet, to just be replicated "as is" into the Destination workbooks, Lookups worksheet. I then want to do my data validation from that worksheet, which of course is open (data validation appears to only work with open workbooks).
I've investigated the techniques in this link: [URL]
Questions:
1) Are the techniques in that link about the best approach? i.e. an external link plus array formulas?
2) A blank cell in the source workbook (text column but formatted as General) is resulting in a zero in the external link. How can I make the external link exactly match the text as entered in the source workbook?
View 5 Replies
View Related
Nov 4, 2009
im having trouble with an IF argument as you can see from example the data sheet is where i need the result,the first formula i have done in B24 but cant understand why the 2nd argument will not go in and i keep getting a value error as shown in C24.
i need say If in the sunday tab G8="A1"then insert G32.Then do it for "A2"=G32 and so on.all in Data B24
Is there a shorter way as i have to go up to A9 B9 C9 D9.
View 2 Replies
View Related
Nov 11, 2009
I have a sheet that has 2 fields that i need a yes/no answer from. Basically if b = "P1" then a should be less than or equal to 4 to reply good otherwise it should reply no. but if b isnt "P1" but instead is P2 P3 or P4 then it should => 10, 30, 40 respectively.
View 8 Replies
View Related
Sep 25, 2008
how to create a function argument containing my own defined formula?
View 9 Replies
View Related
Mar 15, 2009
does IF in excel formula take 27 Arg and ( AND, OR) in IF ststement take the same Arg
and does SumProduct Take the same Arg .
View 9 Replies
View Related
Jul 19, 2007
The second subroutine below selects a range of cells, in this case a column. It selects a range that ends with the last cell that has data and starts with either the first cell that has data or the second cell has data (needed for instance if the first cell is just the heading and doesn't contain data). You'll notice I have hardcoded the "includeFirst" option right now. I don't know how to pass this as an argument when calling this subroutine.
In the first subroutine updateAll() I need to call the second subroutine and want to pass an argument to it. Maybe my approach using subs and application.run is the wrong way to do this?
Sub updateAll()
includeHeader = False
Application.Run "SelectColumn"
' need something like:
' Application.Run "SelectColumn(includeHeader)"
' where subroutine below has something like:
' Sub SelectColumn(includeFirst)
End Sub
Sub SelectColumn()
'Select a Column or Row of Cells in a Used Range Quickly
'http://msdn2.microsoft.com/En-US/library/aa155432(office.10).aspx
includeFirst = False
'includeFirst = True
Dim UpBound As Range
Dim LowBound As Range
If ActiveCell.Row > 1 Then
If IsEmpty(ActiveCell.Offset(-1, 0)) Then
Set UpBound = ActiveCell........................
View 3 Replies
View Related
Jan 8, 2014
Is it possible to create an IF argument based on the filename?
Example - A2=IF(Filename="template",A1,Filename)
Reason - A1 is the result of a MAX function on the template WB but once template is saved as a different file name I want A2 to = the new filename?
View 10 Replies
View Related
May 23, 2008
formula to calculate the commission based on 9 cases each case is subjected to 4 differant arguments.
here is the formula for the first case (the answer if true 1.4) & the last case( if all the casses are fails it should show 0.6) u will find it in cell K5
=IF(AND(E5>=20,H5=1,I5>=80,J5>=80),1.4,0.6)
this is only 1 case HOW can i calculate it basd on 9 casses??
View 10 Replies
View Related
Nov 3, 2009
I'm fairly new to VBA (exactly 8 hours of paid experience ) and I've stumbled upon the following.
Say I wanted to select a certain range of cells (which later have to be merged, don't ask why, they just have to. It's in the job description and it's not in my power to change things around here).
View 14 Replies
View Related
Jan 23, 2008
When I try a MATCH function, I substituted the range through the ADDRESS function. But, it returns #VALUE error. When I manually typed the same range address, it produces the results. I've been behind this more than 8 hours still I can resist the heat on my cool head! But, I thought you coolest head guys need some heat to warm up for to-day's challenge.
View 9 Replies
View Related
Dec 22, 2009
i have a calendar with the dates in a row
I want to count instances of an entry under the dates using 'countif' from 01JAN until today.
My problem is that today changes value [up by one] each day so the 'countif' function will need to extend its range to the right by one cell each day.
View 11 Replies
View Related
Nov 7, 2011
I am trying to write a macro that has multiple if arguments.
An example is as follows:
If cell b11 had fill colour red, then colour fill cell B8 green,
If cell b11 had fill colour green, then colour fill cell B8 red,
If cell b11 had fill colour yellow, then colour fill cell B8 blue,
If cell b11 had fill colour blue, then colour fill cell B8 yellow,
end if.
View 5 Replies
View Related
Mar 14, 2013
In the Formula below I am attempting count records that are not "Closed" or "Cancelled"
But records with those two status values are still being counted I have a feeling that my attempt to create a "not equal to" condition may be the problem, even though Excel did not error when I put in this formula. I am certain that the worksheet and columns that these conditions are pointing to are correct. Note that the first 2 conditions are working correctly.
=COUNTIFS('QC Extract'!$C:$C,$B34,'QC Extract'!$I:$I,F5,'QC Extract'!$H:$H," Closed",'QC Extract'!$H:$H," Cancelled")
View 2 Replies
View Related
Jun 4, 2009
I need a simple IF AND formula. I just can never manage to get them right. I need a formula (in Column M) to evaluate a date count in Column L (which is a count of business days since another date, fyi). It needs to check to see if the number of days since the date in Column L is greater than 10 AND if the value of Column I is one or zero. If the argument returns true (more than ten days and a zero in Column I) it should return a vaue of "Yes" and "No" if false.
View 9 Replies
View Related
Dec 11, 2006
I want to be able to call a procedure and pas 2 variables that it will need to it.
The code looks like this:
Private Sub UpdateScreen(StartLine As Byte, EndLine As Byte)
End Sub
UpdateScreen(104 , 140)
For some odd reason I get an "Expected: = "error when I enter the last line. I works if I send only one variable, but not when I send 2.
View 2 Replies
View Related
Jan 20, 2007
I am trying to compute correlations using Correl function available in Excel. Get "Argument Not Optional" Error. Cannot understand what I am doing wrong.
Sub test()
With Worksheets("Corr")
Range("H1").Value = WorksheetFunction.Correl(Range("A1:A252, B1:B252"))
End With
End Sub
View 4 Replies
View Related
May 7, 2007
i want to create a lot of buttons, one in each line, that, when you click on them, open a file. The filename is in a cell in the same row as the button.
Of course every button should open a different file, and that is the problem. As far as i know (not very much) the buttons can only call other subs, and not with an argument.
What should i put into the "onAction" property of each button, so that each button opens a different file? I really dont want to create hundreds of subs just to get this done, there must be another way.
PS: By the way, how can i delete all but one buttons of a sheet with a vba script? Or shall I open another post for that?
View 3 Replies
View Related
Jul 16, 2009
I have a 100 element header row. Each cell represents an account. I want to sum the amounts of each subsequent row if the word "saving" shows up in the header. For instance, there may be "saving 1" "Savings for Xmas" "Savings 2" in the header row, and I want those to trigger the sumif function.
Basically I want something like sumif(B2:B101,exact(left(B2:B101,6),"saving"),A2:A101)
View 3 Replies
View Related
Nov 7, 2007
This error occured me, and i clicked "Debug" to see where was the error and i found a strange thing that i don't know how to solve it:
The line has the following
View 10 Replies
View Related
Sep 16, 2009
I have an attached file and I am trying to build a VBA function to calculate total values. First row is "RollingTime" and for example if I am trying to calculate the "Total" value. For "RollingTime" = 2 it should be
RollingTime(2)*Percentage(2)+RollingTime (1)*(1-Percentage(1))*Percentage(2)+RollingTime(0)*(1-Percentage(0)*(1-Percentage(1))*Percentage(2)
Which is 109732508*0,3 + 1017508995*(1-0,2)*0,3+1587172158*(1-0,1)*(1-0,2)*0,3
And here is the code I have tried to produce:
View 10 Replies
View Related
Oct 13, 2008
spreadsheet has daily hours worked per employee and a weekly total. What is the formula to take the weekly total per employee and separate the regular hours (first 40) and have the overtime show up in the next column (without getting negative numbers for the totals under 40).
View 4 Replies
View Related
Jan 5, 2012
With the UDF below and the portion highlighted in red, how can the red part be made part of the arguments instead of specifying it in the code?
Code:
Function Countcolor(rColor As Range, rCountRange As Range)
Dim rCell As Range
Dim iCol As Integer
Dim Result
Application.Volatile
[Code]....
View 5 Replies
View Related
Aug 29, 2013
I have hit the limit with IF statements in a formula I have in a questionnaire that I made in Excel 2010. How would I create this formula in VBA?
"TRUE" is already returned in those cells where a "Yes" radio button is selected.
I would like the macro to run when a button is selected, and for it to post the return (i.e., "BP Owned Circuit") in cell B6.
Here's the formula:
= IF(AND(C3=TRUE,C4=TRUE,C9=TRUE,C10=TRUE,C11=TRUE,C14=TRUE,C15=TRUE,C16=TRUE,
C17=TRUE,C18=TRUE,C19=TRUE),"BP Owned (Circuit)",
IF(AND(C6=TRUE,C9=TRUE,C10=TRUE,C11=TRUE,C14=TRUE,C15=TRUE,C17=TRUE,C18=TRUE,C19),"BP Owned (VPN)",
IF(AND(C6=TRUE,C7=TRUE,C8=TRUE,C9=TRUE,C10=TRUE,C18=TRUE,C19=TRUE),"Shared VPN (IPSec)",
[Code] .........
View 1 Replies
View Related