Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default referencing external workbook using variables

i've restructured..

Note: instrREV is EXCEL2000+

you'll need the [] around the file excluding the preceding path
you'll need single quotes for path/filenames with spaces.

the formula can be set for the entire range.
you'll get prompted (by excel) if sheet "Offene" doenst exists in file
selected by user.

cheerz!

Option Explicit


Private Function fileselect()
'get the current worksheet and workbook name
'*******set the inputList path*******
fileselect = Application.GetOpenFilename("Excel files (*.xl*),*.xl*", _
1, "Select the input list", "select", False)
End Function

Private Sub main()
Dim sFormula As String
Dim sPath As String
Dim iPos As Integer
sPath = fileselect
If sPath = "" Then Exit Sub
iPos = InStrRev(sPath, "\")
sPath = Mid(sPath, 1, iPos) & "[" & Mid(sPath, iPos + 1) & "]"
sFormula = "=COUNTIF('" & sPath & "Offene'!C6,""be"")"
On Error Resume Next
ActiveSheet.Range("r6:aq6").FormulaR1C1 = sFormula
End Sub




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


aherrera wrote:

Hello all,

I am working with two worksheets, and I need to use the formula COUNTIF
referencing another workbook. Unfortunately the name of the second
workbook changes so I have written a routine that asks the user to
point to that other workbook and thus save the path and file name.

However, when I try to enter the pathname as a variable in the formula,
I get an error. I have the following code (the problem is at the end of
info_processor() )

I appreciate any help.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel (2003) crashes when referencing to external workbook in freezeframe dmkAlex Excel Worksheet Functions 0 November 27th 09 03:25 PM
Help! Need to lookup referencing 2 variables I M Desperate!!! Excel Worksheet Functions 3 June 17th 08 02:14 AM
referencing a value from a chart with 3 variables KP@RG New Users to Excel 1 December 12th 06 02:29 PM
Variables in links and external file references Nate Links and Linking in Excel 1 October 12th 05 12:54 PM
Referencing Variables Dwinmac Excel Worksheet Functions 1 November 16th 04 06:18 PM


All times are GMT +1. The time now is 07:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"