![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 12
|
The code below runs a function to get data from closed workbooks. Where it specifies range "AD:AD" can i put a formula in to count if range AD contains certain values??
cValue = GetInfoFromClosedFile(FolderName, wbList(i), wsName, ("AD:AD")) Cells(r, 2).Formula = cValue Private Function GetInfoFromClosedFile(ByVal wbPath As String, wbname As String, wsName As String, cellRef As String) As Variant Dim arg As String GetInfoFromClosedFile = "" If Right(wbPath, 1) <> "" Then wbPath = wbPath & "" If Dir(wbPath & "" & wbname) = "" Then Exit Function arg = "'" & wbPath & "[" & wbname & "]" & wsName & "'!" & Range(cellRef).Address(True, True, xlR1C1) On Error Resume Next GetInfoFromClosedFile = ExecuteExcel4Macro(arg) End Function |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Hi
I don't know if you can or not. Try it. Search help for "Using Excel Functions in Your Code" If not, you can always loop down the column and check the cells individualy.. Tom |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|