excel - Retrieve Cell Value from another workbook using a reference cell location -
So I have digged something and I feel that I have found the necessary pieces to achieve my goal but bother me Having trouble in doing the pieces in the right order together. I have referenced a cell value using my file location from a separate workbook and copied that active workbook to that value
My problem comes when I want to have the file space active in my This idea comes from a reference cell within the workbook, rather than the embedded file location in the code that other users will copy their file location into the reference file. And the macro pulls the necessary values from that file.
This is my code that works with the incoming location from the code
Pvt all command buttons (1_Click) as Dim XL Excel. App as Dell BBK Excel Set Workbook Set XL = Create Object ("Excel.Application") WBK = XL.Workbooks.Open ("R: \" branches ("H3") = WBK Sheet ("Master Input"). Range ("B58 ") (Branches \ XXX \ XXX \ XXX \ Master Lawn Memo 8-14.Clux") ActiveWorkbook.Sheets ("Sheet1") .Value WBK.Close Set XL = None End Sub My revised version is to try to complete what I had explained earlier:
Private sub-command button (2_Click) as the XL XL Extra Set as Excel, Excel.Workbook slots as String Location = ActiveWorkbook.Sheets ("Sheet2"). Range ("B2"). Set Value XL = Create Object ("Excel.Application") WBK = XL .Workbooks.Open (Location) ActiveWorkbook.Sheets ("That range (" H3 ") = WBK.Sheets (" Master Input "). Range (" B58 "). Value WBK.Close Set XL = None End Sub < / Code> I is getting the runtime error telling 1004 file location. Any help would be greatly appreciated.
I intentionally use bad Time problem can not be repeated to EXCEPT File location (i.e., a location that is not present in my environment) Since it seems that your directory structure can be deeper than many levels, and since you can not change the drive letter Referencing, maybe the location is misspelled? Try moving the file that you are looking for in your C drive, Sheet 2 Change the value accordingly in B2 and check.
BTW, I do not have a problem in copying those values, which use different functions, ampersons, and containment.
Comments
Post a Comment