Ok thanks for the excellent help, it really helped.
Now for an easy one
I have a cell (c3) that contains the absolute row and column of a cell
(say
$e$9)
How can I pull the contents out of a cell in another excel file using the
contents of the cell above and place in the current cell that i am looking
at (g5).
Something like [spreadsheet.xls]sheet1=cell("contents",c3)
I know the above will not work but it might help explain the issue.
Thanks again for your help.
J.E. McGimpsey said:
One non-programming way (array-entered: CTRL-SHIFT-ENTER or
CMD-RETURN):
=INDEX(data1!G:G,MATCH(TRUE,(data1!G1:G65535<>worksheet2!C2),0))
One programming way:
Public Function FirstNonMatch(sNonFind As String, rng As Range) _
As Variant
Dim cell As Range
Dim found As Boolean
For Each cell In rng
If Not IsEmpty(cell.Value) And (cell.Value <> sNonFind) Then
found = True
Exit For
End If
Next cell
If Not found Then
FirstNonMatch = CVErr(xlErrNA)
Else
FirstNonMatch = cell.Text
End If
End Function
Call as
Dim myvar
myvar = FirstNonMatch(Sheets("worksheet2").Range("C2"), _
Sheets("data1").Range("G1:G" & Range("G" & _
Rows.Count).End(xlUp).Row))
If VarType(myvar) = vbError Then
MsgBox "Not found"
Else
MsgBox myvar
End If
or from the worksheet
=firstnonmatch(worksheet2!C2,G1:G52)
I need to create a procedure that excel can call that will then take
in a string variable and return another string variable.
Here is what i need.
Say I pass in the string 'jones' from worksheet2 cell c2. I need the
procedure to loop through all of the cells in column g of a seperate
excel spreadsheet (say the name is data1) and once it reaches a cell
with a string other than 'jones' I need the procedure to exit and
return the value of the string that does not equal the string 'jones'.
Is this possible in Excel???
Thanks again in advanced for your help!!