+ Reply to Thread
Results 1 to 6 of 6

Extracting filename of workbook in addition to cell values extracted from that workbook

  1. #1
    Registered User
    Join Date
    10-19-2011
    Location
    East Coast
    MS-Off Ver
    Office 365
    Posts
    33

    Extracting filename of workbook in addition to cell values extracted from that workbook

    Hello,

    I have code that extracts information present in particular cells in the target worksheet of Excel workbooks present in a OneDrive folder. I can successfully extract out the desired information from the target worksheet and I would also like to write out the filename of the Excel workbook that those values came from. I have the code below, but it is pulling the name of the Excel workbook that the data is written to - and I need to pll the name of the Excel workbook that the data is being extracted from. What adjustments do I need to make? The current version of code below.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Extracting filename of workbook in addition to cell values extracted from that workboo

    Isn't cell.value the filename your extracting the values from ?
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Registered User
    Join Date
    10-19-2011
    Location
    East Coast
    MS-Off Ver
    Office 365
    Posts
    33

    Re: Extracting filename of workbook in addition to cell values extracted from that workboo

    Hi Bakerman2 - What the cell.Value writes out is the value present in A14 in the source workbook (11 columns to the right of the 1 column in the target workbook/worksheet) & the value present in B14 in the source workbook (12 columns to the right of the 1 column in the target workbook/worksheet). What else do I need to also write out the Excel filename of the source workbook as well?

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Extracting filename of workbook in addition to cell values extracted from that workboo

    Please Login or Register  to view this content.
    The name between square brackets is the name of the source workbook you're pulling information from.

    So as I read you're code that's the name you're after.

    Changing this

    Please Login or Register  to view this content.
    to this

    Please Login or Register  to view this content.
    will give you the name of the Source workbook.
    Last edited by bakerman2; 03-16-2019 at 08:43 PM.

  5. #5
    Registered User
    Join Date
    10-19-2011
    Location
    East Coast
    MS-Off Ver
    Office 365
    Posts
    33

    Re: Extracting filename of workbook in addition to cell values extracted from that workboo

    This adjustment worked great - I didn't understand exactly what cell.Value was holding. Thank you for pointing that out - much appreciated!

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Extracting filename of workbook in addition to cell values extracted from that workboo

    Glad to help and thanks for rep+.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Extracting data from database and pasting the extracted values on another sheet
    By Navin Agrawal in forum Excel Programming / VBA / Macros
    Replies: 100
    Last Post: 05-07-2018, 02:42 AM
  2. [SOLVED] Extracting values from latest closed workbook into current workbook?
    By biznez in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-23-2015, 09:34 PM
  3. [SOLVED] Copy filename of source workbook to specific cell in specific tab in destination workbook.
    By MagicMan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2015, 10:29 PM
  4. Saving workbook as notepad using cell data for filename & retaining original workbook name
    By peterkerr_13 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-26-2012, 08:07 AM
  5. Replies: 0
    Last Post: 01-12-2012, 04:39 PM
  6. VBA code: save worksheet as separate workbook; use cell values as filename
    By ACurtis802 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 03-17-2009, 07:23 PM
  7. [SOLVED] How do I add a month to a filename extracted from a cell
    By Geoff in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-30-2006, 11:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1