No, I don't actually use "value". That was just an example. the actual variable is "voltage". I compute the average voltage of data stored in one file, and store it in the variable, that is in the file that contains the macro (my summary workbook).
I did make the change and it still doesn't work. The error is "Run-time error '9'; Subscript out of range", for that line. My sheet is in a differnet file than the one with this macro, if that makes any difference. But I changed the filename to the filename of the sheet that has this macro and get the same error, so that's probably not it. In any case, this suggestion doesn't seem to work.
This is the line I have cut from my code and the line that is highlighted with the error
Can "sheets()" reference a filename with extension? I would think logically sheets should reference the sheet name (without an extension), which is not what I'm trying to do. That's why I'm trying to reference that filename. I checked the help file on sheets and it says it's to reference a sheet on the active workbook but that's not what I'm trying to do. I have two different files. The macro is in one file and filling cells in that workbook. The range in the average function is a range of values in another workbook (file).
I also tried using:
and that gave me the same error as I had in my first post. I'm wondering if this might have something to do with a difference in versions of Excel, as I had this working fine on my Excel 2010 system at work. It just doesn't want to run on my Excel 2007 at home. Could this have anything to do with some setting? Macros are enabled but maybe it's something else related to a setting?
Bookmarks