+ Reply to Thread
Results 1 to 7 of 7

Prefixing Worksheet Name with Pulled Data

  1. #1
    Registered User
    Join Date
    07-18-2014
    Location
    Austin, TX USA
    MS-Off Ver
    2007/2010
    Posts
    15

    Prefixing Worksheet Name with Pulled Data

    I have a macro that pulls data from all of the Worksheets in my Workbook (all the same format, data in columns D to Q) and adds it to the Summary Worksheet without issue. But I want to add the source Worksheet name in column A followed by the data from that worksheet. I've tried it with the "'Range("A:A") = ws.name" statement in the three spots that you see it commented out at and it doesn't give me what I want. It either puts "Summary" (the active sheet) or the name of the last worksheet that it pulls from for all of the data. It also fills column A all the way down to row 65536, which is no good. Can someone point me in the right direction with this one? Here is a picture of what I want:

    excel.jpg



    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Prefixing Worksheet Name with Pulled Data

    Please Login or Register  to view this content.
    Last edited by AB33; 02-02-2015 at 12:52 PM.

  3. #3
    Registered User
    Join Date
    07-18-2014
    Location
    Austin, TX USA
    MS-Off Ver
    2007/2010
    Posts
    15

    Re: Prefixing Worksheet Name with Pulled Data

    Thanks for that code AB33, but when I run it, it puts the WS name in column A of the source WS and doesn't copy/paste anything to the Summary WS.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Prefixing Worksheet Name with Pulled Data

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-18-2014
    Location
    Austin, TX USA
    MS-Off Ver
    2007/2010
    Posts
    15

    Re: Prefixing Worksheet Name with Pulled Data

    Thanks again AB33 for the quick response. This code definitely got closer. But I end up with 1 or 2 extra entries in the "Sheet" column and it offsets the data a bit. I end up with the sheet name for Sheet 1 populating next to data from Sheet 2 on 1 row. I messed around with the offsets in your code but that didn't fix the issue.

    excel2.jpg

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Prefixing Worksheet Name with Pulled Data

    I knew that. My code was a guess work based on the last row in column D. It all depends on the length of column D. If you deduct 2 or 3 from the last row in column D, that should give you the correct rows.
    Please Login or Register  to view this content.
    You can adjust this line

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-18-2014
    Location
    Austin, TX USA
    MS-Off Ver
    2007/2010
    Posts
    15

    Re: Prefixing Worksheet Name with Pulled Data

    It looks like .Row-1 was the fix. I'm getting all of the data and the Sheet names are lining up perfectly! Thank you so much for your help.
    Last edited by mrdintx2014; 02-02-2015 at 07:31 PM.

+ 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. Formatting data pulled from web
    By cps439 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-25-2011, 04:35 PM
  2. How to retain previous data pulled from a dynamic worksheet
    By GTurley in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-13-2008, 10:08 AM
  3. Merging 2 cells together and prefixing
    By fuzzyjon in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-12-2006, 11:27 AM
  4. [SOLVED] Prefixing a selection of cells with zeros
    By Louise in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-04-2006, 09:35 AM
  5. Need info pulled from worksheet
    By Saut1 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-14-2005, 06:05 PM

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